Point Chart
The Ignite UI for Angular point chart belongs to the group of category charts. It is designed to render the data as points or markers on the chart. The numeric values correspond to y-axis, and the x-axis is used for displaying the labels.
The Angular data chart supports single or multiple point series objects to be rendered, meaning one collection or more than one collection of data.
Demo
Required Axes
The Angular data chart component provides various types of axes but only the following types of axes can be used with IgxPointSeriesComponent.
IgxCategoryXAxisComponentIgxOrdinalTimeXAxisComponentIgxTimeXAxisComponentIgxNumericYAxisComponent
Required Data
The IgxPointSeriesComponent has the following data requirements:
- The data source must be an array or a list of data items.
- The data source must contain at least one data item otherwise the chart will not render the
IgxPointSeriesComponent. - All data items must contain at least one data column (string or date time) which should be mapped to the
Labelproperty of the category axis (e.g.IgxCategoryXAxisComponent) - All data items must contain at least one numeric data column which should be mapped using the
ValueMemberPathproperty of theIgxPointSeriesComponent.
You can use the SampleCategoryData as data source which meets above data requirements.
this.chart.dataSource = SampleCategoryData.create();
Required Modules
Creation of the IgxPointSeriesComponent requires the following modules:
// axis' modules:
import { IgxCategoryXAxis } from "igniteui-angular-charts/ES5/igx-category-x-axis";
import { IgxNumericYAxis } from "igniteui-angular-charts/ES5/igx-numeric-y-axis";
// series' modules:
import { IgxPointSeries } from "igniteui-angular-charts/ES5/igx-point-series";
// data chart's modules:
import { IgxDataChartCoreModule } from "igniteui-angular-charts/ES5/igx-data-chart-core--module";
import { IgxDataChartCategoryModule } from "igniteui-angular-charts/ES5/igx-data-chart-category--module";
@NgModule({
imports: [
// ...
IgxDataChartCoreModule,
IgxDataChartCategoryModule,
// ...
]
})
Code Example - Point Series
This code demonstrates how to create an instance of the Ignite UI for Angular data chart with IgxPointSeriesComponent and bind it to a data source.
<igx-data-chart
[dataSource]="dataSource"
width="700px"
height="500px">
<igx-category-x-axis name="xAxis" label="Year"></igx-category-x-axis>
<igx-numeric-y-axis name="yAxis"></igx-numeric-y-axis>
<igx-point-series
name="series1"
xAxisName="xAxis"
yAxisName="yAxis"
valueMemberPath="USA">
</igx-point-series>
</igx-data-chart>