ChartJsChartProvider class

Chart provider for ChartJS library.

Implements

ChartProvider

Index

Public Methods

Public Methods


draw

Draws the chart.

▸ draw(slot: HTMLElement): void

Parameters:

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

Returns void


getChartType

Returns the current chart type.

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

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


getProviderType

Returns the type of chart provider.

▸ getProviderType(): string

Returns string - the type of chart provider.


getSupportedChartTypes

Returns supported chart types

▸ getSupportedChartTypes(): ChartType[]

Returns ChartType[] - array of supported chart types.


init

Initializes chart provider

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

Parameters:

  • 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


randomColor

Returns a random color from the predefined set of colors.

▸ randomColor(): string

Returns string - the string representation of the color.


setChartType

Sets the chart type

▸ setChartType(newChartType: ChartType): void

Parameters:

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

Returns void


setDataColumns

Sets the columns to be used for chart data.

▸ setDataColumns(dataColumnsIndexes: number[]): void

Parameters:

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

Returns void


setLabelColumn

Sets the column to be used for labels.

▸ setLabelColumn(labelColumnIndex: number): void

Parameters:

  • labelColumnIndex: number - The column index.

Returns void


updateChartColumns

Fills the internal arrays with data from data table.

▸ updateChartColumns(): void

Returns void