echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Add ability to graph Standard Deviation/Confidence Intervals/Error Bars on line and bar charts

Open chandlerlucius opened this issue 9 years ago • 3 comments

Add ability to graph Standard Deviation/Confidence Intervals/Error Bars on line and bar charts

It would awesome if this could become a reality. I have been trying to make it work with markLine, but it is a lot of work and its not really the way it should be.

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.3.2
  • Browser version [浏览器类型和版本]: All browsers (I tested with Chrome)
  • OS Version [操作系统类型和版本]: MacOsx Sierra

Expected behaviour [期望结果]

It would be nice if the charts incorporated standard deviation/confidence intervals/error bars into the api options.

I am not sure how to do it, but it would look really cool on line graphs if the dots representing the value could be layered so as to not overlap as well.

Here is a screenshot of what I have done: screen shot 2016-12-06 at 7 49 51 pm

Here is the code that allows it to happen: markLine: { symbol: "rect", symbolSize: [15, 2], itemStyle: { normal: { color: "#000" } }, label: { normal: { show: false } }, data: [

        [{
            name: 'Visit 1 Weight : 57.75 ± 36.75',
            yAxis: 'Visit 1 Weight',
            xAxis: '94.5',
        }, {
            yAxis: 'Visit 1 Weight',
            xAxis: '21',
        }],
                                                                
        [{
            name: 'dose\n(Concomitant Treatment) : 114.5 ± 86.8245',
            yAxis: 'dose\n(Concomitant Treatment)',
            xAxis: '201.33',
        }, {
            yAxis: 'dose\n(Concomitant Treatment)',
            xAxis: '27.68',
        }],
                                                                
        [{
            name: 'Dose Conmed 1 : 123 ± 89.6517',
            yAxis: 'Dose Conmed 1',
            xAxis: '212.66',
        }, {
            yAxis: 'Dose Conmed 1',
            xAxis: '33.35',
        }],
                                                                
                                                                
        [{
            name: 'Screening Weight : 14.0909 ± 3.7039',
            yAxis: 'Screening Weight',
            xAxis: '17.8',
        }, {
            yAxis: 'Screening Weight',
            xAxis: '10.39',
        }],
                                                                
                                                        ]
                    },
                    data: [
                                                        
        {
            name: 'Visit 1 Weight',
            value: '57.75',
        },
                                                        
        {
            name: 'dose\n(Concomitant Treatment)',
            value: '114.5',
        },
                                                        
        {
            name: 'Dose Conmed 1',
            value: '123',
        },
                                                        
        {
            name: 'Dose Conmed 2',
            value: '55',
        },
                                                        
        {
            name: 'Screening Weight',
            value: '14.0909',
        },
                                                        
        {
            name: 'Visit 2 Weight',
            value: '0',
        },
                                                ]
                },]

As you can see the bars overlap. It would be nice to fix this. Ultimately though, it would be a nice feature to add the entire feature to the library.

Here is an example in plotly (another js chart library): https://plot.ly/python/error-bars/

chandlerlucius avatar Dec 07 '16 01:12 chandlerlucius

@pissang @kener any input on this? I just have the same requirements here? or any alternative?

codTango avatar Apr 17 '17 20:04 codTango

+1 this is extremely useful for statistical graph with the need of showing error and standard deviation is common. right now anyone looking for a work around solution can base on this example: https://ecomfe.github.io/echarts-examples/public/editor.html?c=confidence-band

bobbui avatar Sep 27 '18 01:09 bobbui

For anyone else who is looking, here's another example: https://echarts.apache.org/examples/en/editor.html?c=custom-error-bar

agurtovoy avatar Jan 17 '24 21:01 agurtovoy