Angular ステップ折れ線チャート
Ignite UI for Angular ステップ折れ線チャートは、カテゴリ チャートのグループに属し、連続的な垂直線と水平線で接続されたポイントのコレクションを使用して描画され、階段状のチャートを形成します。値は y 軸に表示され、カテゴリは x 軸に表示されます。IgxStepLineSeriesComponent
は時間毎のデータの変化や複数の項目を比較する場合に用いられます。Angular ステップ折れ線チャートは、ステップ線の下の領域が塗りつぶされていないことを除いて、すべての面で Angular ステップ領域チャートと同じです。
サンプル
軸の要件
Angular データチャート コンポーネントはさまざまなタイプの軸を提供しますが、IgxStepLineSeriesComponent
で使用できるのは以下のタイプの軸のみです。
IgxCategoryXAxisComponent
IgxOrdinalTimeXAxisComponent
IgxTimeXAxisComponent
IgxNumericYAxisComponent
データの要件
IgxStepLineSeriesComponent
には以下のデータ要件があります。
- データソースはデータ項目の配列またはリストである必要があります。
- データソースにはデータ項目を少なくとも 1 つ含む必要があり、含まれない場合はチャートで
IgxStepLineSeriesComponent
がレンダリングされません。 - すべてのデータ項目には、財務軸 (
IgxCategoryXAxisComponent
など) のIgxLabelComponent
プロパティにマッピングする必要があるデータ列 (文字列または日時)を少なくとも 1 列含める必要があります - すべてのデータ項目には、
IgxStepLineSeriesComponent
のValueMemberPath
プロパティにマッピングする必要がある数値データ列を少なくとも 1 列含める必要があります。
上記データ要件を満たすデータソースとして SampleCategoryData を使用できます。
public dataSource: any[] = SampleCategoryData.create();
モジュールの要件
IgxStepLineSeriesComponent
を作成するには、以下のモジュールが必要です。 モジュールはアプリケーションのエントリ ポイントに登録する必要があります。
- DataChartCoreModule;
- DataChartCategoryModule;
- DataChartCategoryCoreModule;
- DataChartInteractivityModule;
// axis' modules:
import { IgxCategoryXAxis } from 'igniteui-angular-charts';
import { IgxNumericYAxis } from 'igniteui-angular-charts';
// series' modules:
import { IgxStepLineSeries } from 'igniteui-angular-charts';
// data chart's modules:
import { IgxDataChartCoreModule } from 'igniteui-angular-charts';
import { IgxDataChartCategoryModule } from 'igniteui-angular-charts';
@NgModule({
imports: [
// ...
IgxDataChartCoreModule,
IgxDataChartCategoryModule,
// ...
]
})
コード例
このコードは、IgxStepLineSeriesComponent
を使用して Ignite UI for Angular データチャートのインスタンスを作成し、それをデータソースにバインドする方法を示します。
<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-step-line-series
name="series1"
xAxisName="xAxis"
yAxisName="yAxis"
valueMemberPath="USA">
</igx-step-line-series>
</igx-data-chart>