sgratzl / chartjs-chart-boxplot

Chart.js Box Plots and Violin Plot Charts
https://www.sgratzl.com/chartjs-chart-boxplot/
MIT License
101 stars 23 forks source link

Issue while plotting boxplot #48

Closed ajmalmajeed97 closed 1 year ago

ajmalmajeed97 commented 1 year ago

Expected behavior

In chart.js while plotting boxplot with different datasets, some of the data is not shown in the chart. Tried with many other datasets, still facing same issue. Please help me to solve this

It should plot boxplot with any datasets ,irrespective of the data(Number Dataset)

Current behavior

In chart.js while plotting boxplot with different datasets, some of the data is not shown in the chart. Tried with many other datasets, still facing same issue. Please help me to solve this

I have tried plotting boxplot with different datasets, for some dataset its not plotting correctly. I think there is some issue in chart.js.

For the same dataset have tried plotting boxplot using Highchart ,there the data is showing correct

Using Chart.js :-[https://codepen.io/sgratzl/pen/QxoLoY] Using Highchart.js:-[https://jsfiddle.net/fo481t6j/1/]

ajmalmajeed97 commented 1 year ago

Codepen link for chart.js((v4.0.1, also tried with 3.5.1):-https://codepen.io/ajmalmajeed/pen/xxzyzNM Js fiddle link for Highchartjs:-https://jsfiddle.net/fo481t6j/1/ Dataset used:-[ [ 92.24, 93.16, 93.77, 95.53, 98.64 ], [ 84.87, 91.87, 93.78, 94.93, 96.01 ], [ 89.36, 90.66, 93.15, 94.44, 95.36 ], [ 90.66, 91.58, 92.59, 94.66, 96.49 ], [ 87.63, 91.08, 93.21, 93.7, 96.38 ], [ 86.47, 93.08, 94.88, 95.49, 96.89 ], [ 88.11, 92.96, 93.91, 95.78, 99.43 ], [ 88.72, 93.28, 94.51, 95.75, 100 ], [ 88.17, 93.35, 94.54, 95.89, 96.58 ], [ 92.16, 94.08, 95.04, 95.67, 96.87 ], [ 93.14, 93.31, 94.63, 95.35, 95.96 ], [ 84.64, 84.74, 84.87, 91.25, 96.34 ], [ 90.11, 91.2, 92.1, 93.25, 93.98 ] ]

sgratzl commented 1 year ago

in your codepen you are defining only 5 labels, so it only renders five boxplots? or am I missing something?

sgratzl commented 1 year ago

for the whiskers and boxplot it depends how you configure this plugin:

https://github.com/sgratzl/chartjs-chart-boxplot/blob/e3be15f67d519f10a0f99ae16331f293a070cf97/src/data.ts#L116-L137

e.g. coef: 0 will extend the whiskers to their extremes instead of 1.5 IQR

ajmalmajeed97 commented 1 year ago

@sgratzl I tried changing the "coeff" variable in same file, Still the boxplot is incorrect, if you check the second boxplot the value is different.

sgratzl commented 1 year ago

I still don't understand what "incorrect" means? can you post screenshot/values what the current boxplots are and what they supposed to be?|

ajmalmajeed97 commented 1 year ago

Screenshot 2022-12-06 110205

ajmalmajeed97 commented 1 year ago

Hi if you check the second dataset, lowest value is 84.87,But while plotting boxplot, the graph doesn't show this value in chart(Please check second boxplot)

ajmalmajeed97 commented 1 year ago

I tried editing "coef" variable to zero, but still its not working. Please check

ajmalmajeed97 commented 1 year ago

@sgratzl Screenshot 2022-12-06 143208

ajmalmajeed97 commented 1 year ago

@sgratzl Above picture shows the correct boxplot ,if you check the second boxplot you can see difference in values

sgratzl commented 1 year ago

when I plot the second dataset in R in looks the same as in this plugin:

image

since this plugin is modeled by default as R, I think it is correct.

However, when I set the coef to 0 (i.e. extend whiskers to min max:

https://codepen.io/sgratzl/pen/ZERwEBX

image

ajmalmajeed97 commented 1 year ago

@sgratzl Thanks a lot, Its working now.

ajmalmajeed97 commented 1 year ago

By using 'coef' to zero, length of whiskers can be extended.Thanks @sgratzl