Closed adminoid closed 5 years ago
Did like this:
<la-cartesian :width="470" :height="100" autoresize :data="topChartData">
<la-area v-for="prop in topChartDataKeys" curve :curve="curveStep" :prop="prop" :key="topChartData.time">
<svg>
<defs>
<lineargradient id="color-id" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#2c3e50"></stop>
<stop offset="1" stop-color="#6fa8dc"></stop>
</lineargradient>
</defs>
</svg>
</la-area>
</la-cartesian>
// metric is an array containing the necessary things
let topChartData = [], topChartDataKeys = [];
metrics.forEach(metric => {
let topChartDataItem = {
time: metric.time,
};
metric.hashrates.forEach((hash, index) => {
let key = 'val_' + index;
topChartDataItem[key] = _.round(_.sum(hash.values), 1);
if( !_.includes(topChartDataKeys, key) ) {
topChartDataKeys.push(key);
}
});
topChartData.push(topChartDataItem);
});
this.topChartDataKeys = topChartDataKeys;
this.topChartData = topChartData;
I have array of data:
For the example above - I need to draw two parallel diagrams for ethash and equihash. Something like that:
But I haven't prop... I have only index in "horizontal" array. Is it possible to use laue in my case, or do I need use only native d3?