Skip to content

Examples

Bar With Error Bars

Code

ts
export const config: ChartConfiguration<'barWithErrorBars'> = {
  type: 'barWithErrorBars',
  data: {
    labels: ['A', 'B'],
    datasets: [
      {
        data: [
          {
            y: 4,
            yMin: 1,
            yMax: 6,
          },
          {
            y: 2,
            yMin: 1,
            yMax: 4,
          },
        ],
      },
    ],
  },
};

Line With Error Bars

Code

ts
export const config: ChartConfiguration<'lineWithErrorBars'> = {
  type: 'lineWithErrorBars',
  data: {
    labels: ['A', 'B'],
    datasets: [
      {
        data: [
          {
            y: 4,
            yMin: 1,
            yMax: 6,
          },
          {
            y: 2,
            yMin: 1,
            yMax: 4,
          },
        ],
      },
    ],
  },
};

Scatter With Error Bars

Code

ts
export const config: ChartConfiguration<'scatterWithErrorBars'> = {
  type: 'scatterWithErrorBars',
  data: {
    labels: ['A', 'B'],
    datasets: [
      {
        data: [
          {
            x: 2,
            xMin: 1,
            xMax: 3,
            y: 4,
            yMin: 1,
            yMax: 6,
          },
          {
            x: 7,
            xMin: 6,
            xMax: 9,
            y: 2,
            yMin: 1,
            yMax: 4,
          },
        ],
      },
    ],
  },
};

Polar Area With Error Bars

Code

ts
export const config: ChartConfiguration<'polarAreaWithErrorBars'> = {
  type: 'polarAreaWithErrorBars',
  data: {
    labels: ['A', 'B'],
    datasets: [
      {
        data: [
          {
            r: 4,
            rMin: 1,
            rMax: 6,
          },
          {
            r: 2,
            rMin: 1,
            rMax: 4,
          },
        ],
      },
    ],
  },
};