Hello Syncfusion,
I am trying to build a stacked column graph, dynamically. Please see attached image. This image is the graph that I want to build in Vue Js using the Syncfusion chart tools.
The data along the x-axis varies. The data along the y-axis varies. And most importantly, the number of stacked portions on any given stacked column on any given month/year varies and this is circled in the image. This is key, because I will not know ahead of time how many users will need to be mapped.
How does one build these stacked columns dynamically using the Syncfusion chart tools? Please provide a simple example in Vue.js using the Syncfusion stacked column
Thanks,
Frank Casali
Attachment: Dynamic_Stacked_Columns_6bed9f02.zip
|
<ejs-chart >
<e-series-collection>
<e-series v-for="d in chartData"
:dataSource=d.dataSource
:type=d.type
:xName=d.xName
:yName=d.yName
:name=d.name
legendShape='Circle'>
</e-series>
</e-series-collection>
</ejs-chart> |
Durga,
Please show what the data model that would populate this loop that you coded above.
Thanks,
Frank
|
let seriesCollection = [];
let value = 80;
for (let i = 1; i <= 100; i++) {
let data =[];
for(let j = 1; j<= 4; j++){
if (Math.random() > .5)
value += Math.random();
else
value -= Math.random();
data.push({ x: new Date(1960, (j + 1), j), y: Math.round(value) });
}
let series = {
type : 'StackingColumn',
dataSource: data,
xName: 'x',
yName: 'y',
name: "Series "+ i,
};
seriesCollection.push(series);
}
export default Vue.extend({
data: function() {
return {
chartData: seriesCollection
}
}
}); |