System Documentation
    Preparing search index...

    Function CreateChart

    • This function creates a new Chart.js chart. If a chart already exists, it is destroyed before a new one is created.

      Parameters

      • type: keyof ChartTypeRegistry

        The type of chart to create (e.g., 'line', 'bar', 'pie').

      • data: ChartDatasets

        The data for the chart, which should be an array of objects.

      • label: string | string[]

        The label/s for the data.

      • title: string

        The title of the chart.

      • OptionalscaleOptions: _DeepPartialObject<
            {
                [key: string]: ScaleOptionsByType<
                    "radialLinear"
                    | (keyof CartesianScaleTypeRegistry),
                >;
            },
        >

        The scape options for the chart.

      • OptionalzoomOptions: _DeepPartialObject<ZoomPluginOptions>

        The zoom options for the chart.

      • OptionalannotationOptions: _DeepPartialObject<AnnotationPluginOptions>

        The annotation options for the chart.

      • Optionalsubtitle: string

        The subtitle of the chart.

      Returns void

      // Create a bar chart
      const data = [
      {
      "label": "bbb",
      "data": [
      16912.75
      ],
      "borderColor": "#33ef4b",
      "backgroundColor": "#33ef4b"
      }
      ];
      CreateChart('bar', data, 'My Label', 'My Title');