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

Is it possible to have different colors for each datapoint? #123

Closed abdulmannanbasf closed 3 weeks ago

abdulmannanbasf commented 1 month ago

I'm having the following question...

Screenshots / Sketches ![Uploading Screenshot 2024-05-17 123551.png…]()

Context

Additional context

 datasets: [{
          type: 'boxplot',
          backgroundColor: 'rgba(33,160,210,1)',
          borderColor: '#004A96',
          borderWidth: 1,
          outlierColor: 'rgba(25,25,25,1)',
          **itemBackgroundColor**: ['rgba(123, 45, 67, 0.12)', 'rgba(234, 56, 78, 0.45)', 'rgba(89, 123, 45, 0.78)', 'rgba(12, 34, 56, 0.90)'],
          quantiles: 'midpoint',
          itemRadius: 5,
          data: [[22,10,11,4]]
        }]

Data point and color 22 rgba(123, 45, 67, 0.12) 10 rgba(234, 56, 78, 0.45) 11 rgba(89, 123, 45, 0.78) 4 rgba(12, 34, 56, 0.90)

I tried above code but it takes the first color for the item. So is it possible with the library to have different colors for each item? if not, any clue for custom plugin to achieve the same.

sgratzl commented 3 weeks ago

this is currently not supported. There is only limited item rendering support for items since this plugin is about rendering boxplots