sgratzl / chartjs-chart-boxplot

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

Type improvements for `IBoxPlot` and other interfaces #120

Closed fnimick closed 3 months ago

fnimick commented 4 months ago

Currently, IBoxPlot and the other data interfaces requires all members to be defined.

This results in e.g.

  let data = {
    min: 1,
    q1: 2,
    median: 3,
    q3: 4,
    max: 5,
  } satisfies IBoxPlot;

having a compile error due to the missing whiskerMax, whiskerMin, mean, items, outliers members - even though it works fine at runtime.

It would be great if there were well-defined object types that could be used to strongly type the data input, with members appropriately marked as optional.

sgratzl commented 3 months ago

have you tried using https://www.sgratzl.com/chartjs-chart-boxplot/api/type-aliases/BoxPlotDataPoint.html instead?