Open NeeruAR opened 2 years ago
I am trying to use the aggregate sum method in echart but it is not giving proper result. For the month of Mar output should be 1000, for April 210 and for August 148.
$.when( $.getScript( 'https://fastly.jsdelivr.net/npm/echarts-simple-transform/dist/ecSimpleTransform.min.js' ) ).done(function (res) { run(res); }); function run() { echarts.registerTransform(ecSimpleTransform.aggregate); option = { dataset: [ { id: 'raw', dimensions: ['billAmount', 'billMonth'], source: [ { billMonth: 'Mar', billAmount: '400' }, { billMonth: 'Mar', billAmount: '100' }, { billMonth: 'Mar', billAmount: '500' }, { billMonth: 'April', billAmount: '10' }, { billMonth: 'April', billAmount: '200' }, { billMonth: 'August', billAmount: '148' } ] }, { id: 'month', fromDatasetId: 'raw', transform: [ { type: 'filter', config: { dimension: 'billMonth', eq: 'Mar' } } ] }, { id: 'bill_sum', fromDatasetId: 'raw', transform: [ { type: 'ecSimpleTransform:aggregate', config: { resultDimensions: [ { from: 'billAmount', method: 'sum' }, { from: 'billMonth' } ], groupBy: 'billMonth' } } ] }, ], title: { text: 'SUM OF BILL' }, tooltip: { trigger: 'axis', confine: true }, xAxis: { name: 'billMonth', nameLocation: 'middle', nameGap: 30, scale: true, type: 'category', boundaryGap: true, axisLabel: { interval: 0, fontSize: 12, rotate: 15 } }, yAxis: { type: 'value', axisLabel: { interval: 0, fontSize: 12, rotate: 7 } }, grid: { bottom: 100 }, legend: { width: 330, type: 'scroll' }, series: [ { type: 'bar', datasetId: 'bill_sum', name: 'billamount', encode: { x: 'billMonth', y: 'billAmount' }, color: 'red' } ] }; myChart.setOption(option); }
Error Output :
In my case it always skips the first row.
duplicate of #1
I am trying to use the aggregate sum method in echart but it is not giving proper result. For the month of Mar output should be 1000, for April 210 and for August 148.
Error Output :