Skip to content

ChartJsChartProvider class

Chart provider for ChartJS library.

ChartProvider


Draws the chart.

▸ draw(slot: HTMLElement): void

  • slot: HTMLElement - The [[HTMLElement]] to draw the chart within.

Returns void


Returns the current chart type.

▸ getChartType(): "bar" | "horizontalBar" | "line" | "pie"

Returns "bar" | "horizontalBar" | "line" | "pie" - the string representation of chart type.


Returns the type of chart provider.

▸ getProviderType(): string

Returns string - the type of chart provider.


Returns supported chart types

▸ getSupportedChartTypes(): ChartType[]

Returns ChartType[] - array of supported chart types.


Initializes chart provider

▸ init(dataTable: EqDataTable,defaultType: ChartType,labelColumnIndex: number,dataColumnIndexes: number[]): void

  • dataTable: EqDataTable - The [[EqDataTable]] to build chart on.
  • defaultType: ChartType - The default [[ChartType]].
  • labelColumnIndex: number - The index of the columns to be used for labels.
  • dataColumnIndexes: number[] - The array of column indexes to be used for chart data.

Returns void


Returns a random color from the predefined set of colors.

▸ randomColor(): string

Returns string - the string representation of the color.


Sets the chart type

▸ setChartType(newChartType: ChartType): void

  • newChartType: ChartType - The [[ChartType]].

Returns void


Sets the columns to be used for chart data.

▸ setDataColumns(dataColumnsIndexes: number[]): void

  • dataColumnsIndexes: number[] - The array of column indexes.

Returns void


Sets the column to be used for labels.

▸ setLabelColumn(labelColumnIndex: number): void

  • labelColumnIndex: number - The column index.

Returns void


Fills the internal arrays with data from data table.

▸ updateChartColumns(): void

Returns void