Data Chart

The Angular data chart is a charting component that provides modular design of axis, markers, series, legend, and annotation layers. With this data chart, you can create multiple instances of these visual elements in the same chart plot area in order to create composite chart views.

Demo

Dependencies

When installing the data chart package, the core package must also be installed.

  • npm install --save igniteui-angular-core
  • npm install --save igniteui-angular-charts

Required Modules

The Angular data chart component requires the following modules:

// data chart's modules required for all series:

import { IgxDataChartCoreModule } from "igniteui-angular-charts/ES5/igx-data-chart-core--module";
import { IgxNumberAbbreviatorModule } from 'igniteui-angular-charts/ES5/igx-number-abbreviator-module';
// scatter series' modules:
import { IgxDataChartScatterCoreModule } from "igniteui-angular-charts/ES5/igx-data-chart-scatter-core-module";
import { IgxDataChartScatterModule } from "igniteui-angular-charts/ES5/igx-data-chart-scatter-module";
// scatter series elements:
import { IgxBubbleSeriesComponent } from "igniteui-angular-charts/ES5/igx-bubble-series-component";
import { IgxNumericXAxisComponent } from "igniteui-angular-charts/ES5/igx-numeric-x-axis-component";
import { IgxNumericYAxisComponent } from "igniteui-angular-charts/ES5/igx-numeric-y-axis-component";
import { IgxSizeScaleComponent } from "igniteui-angular-charts/ES5/igx-size-scale-component";
import { IgxValueBrushScaleComponent } from "igniteui-angular-charts/ES5/igx-value-brush-scale-component";

@NgModule({
    imports: [
        // ...
        IgxDataChartCoreModule,
        IgxDataChartScatterCoreModule,
        IgxDataChartScatterModule,
        IgxNumberAbbreviatorModule
    ]
})
export class AppModule { /* ... */ }

Supported Series

The Angular data chart component supports over 65 types of series including Category Series, Financial Series, Polar Series, Radial Series, Range Series, Scatter Series, and Shape Series. Refer to the Series topic, for a full list of supported types of series and how to use them.

Supported Axes

The Angular data chart component supports various types of axis that are intended to use with specific type of series. The following table lists which axes can be used with type of series. Refer to the Series and Axis topics, for more information on how to use these types of axis.

Axis Type Supported Series Types
CategoryYAxis only bar in Category Series group
CategoryXAxis all Financial Series, Range Series, Category Series (except bar)
TimeXAxis all Financial Series, Range Series, Category Series (except bar)
OrdinalTimeXAxis all Financial Series, Range Series, Category Series (except bar)
PercentChangeYAxis all Financial Series, Range Series, Category Series, Scatter Series, Shape Series
NumericYAxis all Scatter Series, Shape Series, Financial Series, Range Series, Category Series
NumericXAxis all Scatter Series, Shape Series, and bar in Category Series group
NumericAngleAxis all Polar Series
NumericRadiusAxis all Polar Series and Radial Series
CategoryAngleAxis all Radial Series

Usage

Now that the data chart modules are imported, next step is to bind chart to data. All series require specific number and type of data columns to render correctly and you can find a data source for each type of series in the Data Sources topic.

The following code snippet demonstrates how to create scatter bubble and bind it to SampleScatterStats data.

Note

Setting a data source on the chart component will apply to all series but you can also set different data sources on each series added in the data chart.

 <igx-data-chart [dataSource]="data"
                 width="700px"
                 height="500px">
    <igx-numeric-x-axis name="xAxis" isLogarithmic="true" ></igx-numeric-x-axis>
    <igx-numeric-y-axis name="yAxis" isLogarithmic="true" ></igx-numeric-y-axis>
    <igx-bubble-series
        name="series1"
        [xAxis]="xAxis"
        [yAxis]="yAxis"
        xMemberPath="population"
        yMemberPath="gdpTotal"
        radiusMemberPath="gdpPerCapita"
        [dataSource]="data"  ></igx-bubble-series>
 </igx-data-chart>

Additional Resources