ChartJsChartProvider class
Chart provider for ChartJS library.
Implements
Section titled “Implements”- canDraw
- draw
- getChartType
- getProviderType
- getSupportedChartTypes
- init
- randomColor
- setChartType
- setDataColumns
- setLabelColumn
- updateChartColumns
Public Methods
Section titled “Public Methods”canDraw
Section titled “canDraw”Checks that appropriate charting script is loaded.
▸ canDraw(): boolean
Returns boolean - true or false
Draws the chart.
▸ draw(slot: HTMLElement): void
Parameters:
Section titled “Parameters:”- slot:
HTMLElement- The [[HTMLElement]] to draw the chart within.
Returns void
getChartType
Section titled “getChartType”Returns the current chart type.
▸ getChartType(): "bar" | "horizontalBar" | "line" | "pie"
Returns "bar" | "horizontalBar" | "line" | "pie" - the string representation of chart type.
getProviderType
Section titled “getProviderType”Returns the type of chart provider.
▸ getProviderType(): string
Returns string - the type of chart provider.
getSupportedChartTypes
Section titled “getSupportedChartTypes”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
Parameters:
Section titled “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
Section titled “randomColor”Returns a random color from the predefined set of colors.
▸ randomColor(): string
Returns string - the string representation of the color.
setChartType
Section titled “setChartType”Sets the chart type
▸ setChartType(newChartType: ChartType): void
Parameters:
Section titled “Parameters:”- newChartType: ChartType - The [[ChartType]].
Returns void
setDataColumns
Section titled “setDataColumns”Sets the columns to be used for chart data.
▸ setDataColumns(dataColumnsIndexes: number[]): void
Parameters:
Section titled “Parameters:”- dataColumnsIndexes:
number[] - The array of column indexes.
Returns void
setLabelColumn
Section titled “setLabelColumn”Sets the column to be used for labels.
▸ setLabelColumn(labelColumnIndex: number): void
Parameters:
Section titled “Parameters:”- labelColumnIndex:
number- The column index.
Returns void
updateChartColumns
Section titled “updateChartColumns”Fills the internal arrays with data from data table.
▸ updateChartColumns(): void
Returns void