Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while plotting boxplot #48

Closed
ajmalmajeed97 opened this issue Dec 2, 2022 · 13 comments
Closed

Issue while plotting boxplot #48

ajmalmajeed97 opened this issue Dec 2, 2022 · 13 comments
Assignees
Labels
question Further information is requested

Comments

@ajmalmajeed97
Copy link

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 ajmalmajeed97 added the bug Something isn't working label Dec 2, 2022
@ajmalmajeed97
Copy link
Author

ajmalmajeed97 commented Dec 2, 2022

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
Copy link
Owner

sgratzl commented Dec 3, 2022

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

@sgratzl
Copy link
Owner

sgratzl commented Dec 3, 2022

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

/**
* from the R doc: this determines how far the plot ‘whiskers’ extend out from
* the box. If coef is positive, the whiskers extend to the most extreme data
* point which is no more than coef times the length of the box away from the
* box. A value of zero causes the whiskers to extend to the data extremes
* @default 1.5
*/
coef?: number;
/**
* the method to compute the quantiles.
*
* 7, 'quantiles': the type-7 method as used by R 'quantiles' method.
* 'hinges' and 'fivenum': the method used by R 'boxplot.stats' method.
* 'linear': the interpolation method 'linear' as used by 'numpy.percentile' function
* 'lower': the interpolation method 'lower' as used by 'numpy.percentile' function
* 'higher': the interpolation method 'higher' as used by 'numpy.percentile' function
* 'nearest': the interpolation method 'nearest' as used by 'numpy.percentile' function
* 'midpoint': the interpolation method 'midpoint' as used by 'numpy.percentile' function
* @default 7
*/
quantiles?: QuantileMethod;

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

@sgratzl sgratzl added question Further information is requested and removed bug Something isn't working labels Dec 3, 2022
@sgratzl sgratzl self-assigned this Dec 3, 2022
@ajmalmajeed97
Copy link
Author

@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
Copy link
Owner

sgratzl commented Dec 5, 2022

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
Copy link
Author

Screenshot 2022-12-06 110205

@ajmalmajeed97
Copy link
Author

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
Copy link
Author

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

@ajmalmajeed97
Copy link
Author

@sgratzl
Screenshot 2022-12-06 143208

@ajmalmajeed97
Copy link
Author

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

@sgratzl
Copy link
Owner

sgratzl commented Dec 6, 2022

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
Copy link
Author

@sgratzl Thanks a lot, Its working now.

@ajmalmajeed97
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants