datavisyn/chartjs-chart-box-and-violin-plot

Box plot not display correctly when data {min:0, q1:41, median:51, q3:63, max:99}

rommy-rumhil opened this issue · 2 comments

im new using boxplot chart js, when i filled data with value {min:0, q1:41, median:51, q3:63, max:99} min and max line didn't show up correctly.

function randomValues(count, min, max) {
const delta = max - min;
return Array.from({length: count}).map(() => Math.random() * delta + min);
}

const boxplotData = {
// define label tree
labels: ['data 1','data 2', 'data 3'],
datasets: [{
label: 'Dataset 1',
backgroundColor: 'rgba(255,0,0,0.5)',
borderColor: 'red',
borderWidth: 1,
outlierColor: '#e53636',
padding: 100,
itemRadius: 0,
data: [
{min:0, q1:41, median:51, q3:63, max:99},
[0, 25, 51, 75, 99]
]
}]
};
window.onload = () => {
const ctx = document.getElementById("canvas").getContext("2d");
window.myBar = new Chart(ctx, {
type: 'boxplot',
data: boxplotData,
options: {
responsive: true,
legend: {
position: 'top',
},
title: {
display: true,
text: 'Chart.js Box Plot Chart'
}
}
});

};

image

Hi.
It is not displayed, if the value is not possible.

Hi.
It is not displayed, if the value is not possible.

thanks, im sorry for my vault...