icCube - Adding the Title (The header) When export the Chart to Image - iccube

I need That the header shows when I export the Chart to Image
My Chart is Like This :
But when I export it to Image it's Without the header
Can any one help me to fix this , Txs, Marwen

AmChart widget allows you to export only widget's content without box header.
You can achieve needed result with AmChart's functionality.
Just set below code as a value to
"Edit... > Widget > Advanced Properties > Extra Options"
:{"allLabels": [
{
"text": "Product Sale",
"size": 32,
"bold": true,
"x": 0,
"y": 0
}]}
UPDATE
If your title overlays the chart you can try to change widget box's height and width along with extending "Extra options" with "marginLeft" and "marginTop" options which allow you to create needed room for chart and it's title:
:{"allLabels": [
{
"text": "Product Sale",
"size": 32,
"bold": true,
"x": 0,
"y": 0
}],
"marginTop":50,
"marginLeft":50}

Related

Amcharts 5 CSS Element

I'm using Amchart 5, I trying to customize the colors, labels and other stuffs using CSS. But Amchart 5 only shows the charts as Canvas not as individual element like amchart 4.
amchart Canvas - Inspect Panel
If someone have solution please let me know, it'll be very helpful.
Thank you in advance.
I'm expecting a code to enables the css in the chart.
You cannot use CSS this way with amCharts 5 because, contrary to amCharts 4, it uses the Canvas API instead of SVG. There is an exception when you need HTML content, though...
Canvas API is generally way faster than SVG, however it paints outside DOM tree, which means you can't target individual chart elements via JavaScript or CSS.
Migrating from amCharts 4 – amCharts 5 Documentation
To customize chart elements, you have to define settings in your JS code. A label, for instance, can be configured like this:
am5.Label.new(root, {
text: "Title",
fill: am5.color("#ff0000"),
fontSize: 25,
fontWeight: "500",
fontStyle: "italic",
textAlign: "center",
x: am5.percent(50),
centerX: am5.percent(50),
dy: -60
// ...
});
You can find a complete list of settings there: Label – amCharts 5 Documentation
Here is a basic example:
am5.ready(() => {
let root = am5.Root.new("chartdiv");
let chart = root.container.children.push(am5xy.XYChart.new(root, {
paddingTop: 50
}));
// ========================= HERE =========================
chart.children.unshift(am5.Label.new(root, {
text: "Title",
fill: am5.color("#ff0000"),
fontSize: 25,
fontWeight: "500",
fontStyle: "italic",
textAlign: "center",
x: am5.percent(50),
centerX: am5.percent(50),
dy: -50
}));
// ==================================================
let xAxis = chart.xAxes.push(am5xy.CategoryAxis.new(root, {
categoryField: "category",
renderer: am5xy.AxisRendererX.new(root, {})
}));
let yAxis = chart.yAxes.push(am5xy.ValueAxis.new(root, {
renderer: am5xy.AxisRendererY.new(root, {})
}));
let series = chart.series.push(am5xy.ColumnSeries.new(root, {
name: "Series",
xAxis: xAxis,
yAxis: yAxis,
categoryXField: "category",
valueYField: "value"
}));
let data = [{
category: "Category 1",
value: 10
}, {
category: "Category 2",
value: 20
}, {
category: "Category 3",
value: 15
}];
xAxis.data.setAll(data);
series.data.setAll(data);
});
#chartdiv {
width: 100%;
height: 350px;
}
<script src="https://cdn.amcharts.com/lib/5/index.js"></script>
<script src="https://cdn.amcharts.com/lib/5/xy.js"></script>
<div id="chartdiv"></div>

Plotly scattergeo map doesn't fill container as intended

I am trying to create a scattergeo map in React using Plotly.
Basically I have a container that have a sidebar, and then the plot, so basically something like:
.main_container {
display: grid;
grid-template-columns: 300px 1fr;
}
However, when I plot it and set the layout parameters as follows:
layout={{
margin: { r: 0, t: 0, l: 0, b: 0 },
showlegend: false,
autosize: true,
geo: {
visible: true,
resolution: 50,
scope: "europe",
showcountries: true,
countrycolor: "#6E6E6E",
showland: true,
landcolor: "#343332",
showocean: true,
oceancolor: "#191A1A",
showlakes: true,
lakecolor: "#191A1A",
showsubunits: true,
subunitcolor: "Blue",
lonaxis: { range: [-10.854492, 28.78418], dtick: 5 },
lataxis: { range: [45.065607, 59.063154], dtick: 5 },
},
}}
The result is:
I know it isn't much (in this case), but there is still a bit of a margin/padding to the left and right. If I dare to put anything on top of the map, e.g. some kind of bar, it just gets worse:
I have even tried giving the plot a width and height in the layout instead of the autosize. But that doesn't help either.
So is that just how Plotly is, or am I doing something wrong ?

Adjust heigh for buttons in Viber bot

I need to display buttons in Viber bot using rich_media message type and Viber REST API.
When buttons are rendered the Rich Media element has a fixed height (see on screenshot).
If there is five buttons in Rich Media element some empty place appear under the last button.
My source sode for rendering buttons:
var reply = {
type: "raw",
method: "send_message",
body: {
receiver: $request.data.chatId,
sender:{
name: "John McClane",
avatar: "http://avatar.example.com"
},
min_api_version: 2,
type: "rich_media",
rich_media: {
Type: "rich_media",
Buttons: [
{
Rows: 1,
ActionBody: "Option 1",
ActionType: "reply",
Text: "Option 1"
},
{
Rows: 1,
ActionBody: "Option 2",
ActionType: "reply",
Text: "Option 2"
},
{
Rows: 1,
ActionBody: "Option 3",
ActionType: "reply",
Text: "Option 3"
},
...
]
}
}
}
I need to adjust the height of Rich Media element so the element stretches depending on the number of buttons. Is there a way to set height or disable default height of Rich Media element?
Found the solution by myself. There is a parameter called ButtonsGroupRows (rich_media.ButtonsGroupRows, docs on this parameter). 7 is default value.

How to right align text in Dash Input Select component with CSS-style?

I am trying to right align the text in Dash Bootstrap Input Select component.
Adding CSS-style: text-align; right does not work (see below):
import dash_bootstrap_components as dbc
select = dbc.Select(
id="select",
options=[
{"label": "Option 1", "value": "1"},
{"label": "Option 2", "value": "2"},
],
style={
'text-align': 'right',
}
)
returning (with text aligned to the left as default). What am I missing?:

Image setSmallSourceUrl is Deprecated?

To add an image to a StandardCard card, I set
Image image = new Image();
where Image comes from com.amazon.speech.ui. Various blogs then say to use
image.setSmallSourceUrl and image.setLargeSourceUrl to set the URLs of the image but these two methods seem to have been deprecated in alexa-skills-kit-1.4.0.
Furthermore, there seem to be two (incompatible) Image classes in play. One in com.amazon.speech.ui.Image and another in com.amazon.speech.speechlet.interfaces.display.element.Image.
1) What is the correct way of adding the two images to a StandardCard?
2) Which of the two image types does StandardCard want?
Below shows the format of response,
{
"version": "1.0",
"response": {
"outputSpeech": {"type":"PlainText","text":"output speech"},
"card": {
"type": "Standard",
"title": "Title",
"text": "sample test",
"image": {
"smallImageUrl": "YourSmallImage here",
"largeImageUrl": "YourLarge image here"
}
}
}
You can provide images in the following formats:
JPEG
PNG
smallImageUrl recommended size is 720w x 480h (in pixels) and largeImageUrl recommended size is 1200w x 800h (in pixels)

Resources