Using AnyChart to generate a bar chart like this:
Inside of Mendix, my app generates the following JSON:
Layout JSON
{
"barmode": "stack",
"bargap": 0.1,
"font": {
"family": "Open Sans",
"size": 14,
"color": "#555"
},
"showlegend": true,
"xaxis": {
"showticklabels": true,
"gridcolor": "$d7d7d7",
"showgrid": false,
"fixedrange": true
},
"yaxis": {
"zeroline": true,
"zerolinecolor": "#ffffff",
"gridcolor": "#d7d7d7"
},
"margin": {
"l": 60,
"r": 60,
"b": 60,
"t": 10,
"pad": 10
}
}
Data JSON
[
{
"x": [
"Aug-20",
"Sep-20",
"Oct-20",
"Nov-20",
"Dec-20",
"Jan-21",
"Feb-21",
"Mar-21",
"Apr-21",
"May-21",
"Jun-21",
"Jul-21"
],
"y": [
73,
23,
50,
39,
42,
49,
45,
68,
18,
56,
48,
0
],
"type": "bar",
"orientation": "v",
"connectgaps": false,
"name": "Existing",
"text": [
"47",
"19",
"32",
"32",
"37",
"44",
"38",
"66",
"18",
"39",
"38",
"0"
],
"textposition": "auto",
"hoverinfo": "none",
"marker": {
"color": "blue"
}
},
{
"x": [
"Aug-20",
"Sep-20",
"Oct-20",
"Nov-20",
"Dec-20",
"Jan-21",
"Feb-21",
"Mar-21",
"Apr-21",
"May-21",
"Jun-21",
"Jul-21"
],
"y": [
52,
8,
36,
14,
10,
10,
14,
4,
0,
34,
20,
0
],
"type": "bar",
"orientation": "v",
"connectgaps": false,
"name": "New",
"text": [
"26",
"4",
"18",
"7",
"5",
"5",
"7",
"2",
"0",
"17",
"10",
"0"
],
"textposition": "auto",
"hoverinfo": "none",
"marker": {
"color": "green"
}
}
]
Here is the domain model used to generate this JSON with an Export Mapping:
Layout Domain Model
Data Domain Model
Hope that helps,
Mike
Hi Mike,
Isn’t there a direct way for displaying text in bars as I found in plotify we can do that with single statement but unable to find how to write it here in JSON