Your search did not match any results.
Range Charts

Timeline Chart

Timeline charts represent events in chronological order.

The exact timeline chart implementation steps depend on the data source. Below are general recommendations on how to create a timeline chart.  

  • Choose a series type
    Each event is represented by its name and start/end dates. In this case, the series type should have points with one argument and two values, for example, the Range Bar.

  • Bind the series to data
    You can bind the series to data directly or use a series template (depending on the data source). These approaches and their differences are described in the Bind Series to Data article. In this demo, we use a series template.

  • Line up bars
    Specify the barOverlapGroup to arrange bars in a line that displays a combined timeline.

  • Rotate the chart
    A range bar chart's bars are vertical. To make them horizontal, set the rotated option to true.

  • Sort the events chronologically
    Arguments maintain objects' order in the data source. If this order is not chronological, use the axis' categories array to specify the order.

https://en.wikipedia.org
Copy to CodeSandBox
Apply
Reset
<dx-chart id="chart" [dataSource]="dataSource" [rotated]="true" [barGroupPadding]="0.2"> <dxo-argument-axis [categories]="['Royal Houses']"> <dxo-tick [visible]="false"></dxo-tick> </dxo-argument-axis> <dxo-title text="The British Monarchy" subtitle="An Abbreviated Timeline" ></dxo-title> <dxo-animation [enabled]="false"></dxo-animation> <dxo-legend verticalAlignment="bottom" horizontalAlignment="center"> <dxo-title text="Royal Houses"></dxo-title> </dxo-legend> <dxo-series-template nameField="house"></dxo-series-template> <dxo-common-series-settings argumentField="monarch" type="rangeBar" rangeValue1Field="start" rangeValue2Field="end" barOverlapGroup="monarchs"> </dxo-common-series-settings> </dx-chart>
import { NgModule, Component, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { DxChartModule } from 'devextreme-angular'; import { Data, Service } from './app.service'; if(!/localhost/.test(document.location.host)) { enableProdMode(); } @Component({ selector: 'demo-app', templateUrl: 'app/app.component.html', styleUrls: ['app/app.component.css'], providers: [Service] }) export class AppComponent { dataSource: Data[]; constructor(service: Service) { this.dataSource = service.getData(); } } @NgModule({ imports: [ BrowserModule, DxChartModule ], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } platformBrowserDynamic().bootstrapModule(AppModule);
::ng-deep #chart { height: 440px; }
import { Injectable } from '@angular/core'; export class Data { house: string; monarch: string; start: Date; end: Date; } let dataSource = [ { monarch: "Anne", start: new Date(1701, 4, 1), end: new Date(1714, 7, 1), house: "Stuart" }, { monarch: "George I", start: new Date(1714, 7, 1), house: "Hanover", end: new Date(1727, 5, 11) }, { monarch: "George II", start: new Date(1727, 5, 11), house: "Hanover", end: new Date(1760, 9, 25) }, { monarch: "George III", start: new Date(1760, 9, 25), house: "Hanover", end: new Date(1820, 0, 29) }, { monarch: "George IV", start: new Date(1820, 0, 29), house: "Hanover", end: new Date(1830, 5, 26) }, { monarch: "William IV", start: new Date(1830, 5, 26), house: "Hanover", end: new Date(1837, 5, 20) }, { monarch: "Victoria", start: new Date(1837, 5, 20), end: new Date(1901, 0, 22), house: "Hanover" }, { monarch: "Edward VII", start: new Date(1901, 0, 22), house: "Saxe-Coburg and Gotha", end: new Date(1910, 4, 6) }, { monarch: "George V", start: new Date(1910, 4, 6), house: "Saxe-Coburg and Gotha", end: new Date(1917, 5, 17) }, { monarch: "George V", start: new Date(1917, 5, 17), house: "Windsor", end: new Date(1936, 0, 20) }, { monarch: "Edward VIII", start: new Date(1936, 0, 20), house: "Windsor", end: new Date(1936, 11, 11) }, { monarch: "George VI", start: new Date(1936, 11, 11), house: "Windsor", end: new Date(1952, 1, 6) }, { monarch: "Elizabeth II", house: "Windsor", start: new Date(1952, 1, 6), end: new Date() }, { house: "Stuart", start: new Date(1701, 4, 1), end: new Date(1714, 7, 1), monarch: "Royal Houses" }, { end: new Date(1901, 0, 22), house: "Hanover", start: new Date(1714, 7, 1), monarch: "Royal Houses" }, { start: new Date(1901, 0, 22), end: new Date(1917, 5, 17), house: "Saxe-Coburg and Gotha", monarch: "Royal Houses" }, { house: "Windsor", start: new Date(1917, 5, 17), end: new Date(), monarch: "Royal Houses" } ]; @Injectable() export class Service { getData(): Data[] { return dataSource; } }
// In real applications, you should not transpile code in the browser. You can see how to create your own application with Angular and DevExtreme here: // https://github.com/DevExpress/devextreme-angular/blob/master/README.md System.config({ transpiler: 'ts', typescriptOptions: { module: "commonjs", emitDecoratorMetadata: true, experimentalDecorators: true }, meta: { 'typescript': { "exports": "ts" } }, paths: { 'npm:': 'https://unpkg.com/' }, map: { 'ts': 'npm:plugin-typescript@8.0.0/lib/plugin.js', 'typescript': 'npm:typescript@3.4.5/lib/typescript.js', '@angular/core': 'npm:@angular/core@8.0.0/bundles/core.umd.js', '@angular/common': 'npm:@angular/common@8.0.0/bundles/common.umd.js', '@angular/compiler': 'npm:@angular/compiler@8.0.0/bundles/compiler.umd.js', '@angular/platform-browser': 'npm:@angular/platform-browser@8.0.0/bundles/platform-browser.umd.js', '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic@8.0.0/bundles/platform-browser-dynamic.umd.js', '@angular/router': 'npm:@angular/router@8.0.0/bundles/router.umd.js', '@angular/forms': 'npm:@angular/forms@8.0.0/bundles/forms.umd.js', '@angular/common/http': 'npm:@angular/common@8.0.0/bundles/common-http.umd.js', 'tslib': 'npm:tslib/tslib.js', 'rxjs': 'npm:rxjs@6.3.3', 'rxjs/operators': 'npm:rxjs@6.3.3/operators', 'devextreme': 'npm:devextreme@19.1', 'jszip': 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.6/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', 'devextreme-angular': 'npm:devextreme-angular@19.1' }, packages: { 'app': { main: './app.component.ts', defaultExtension: 'ts' }, 'devextreme': { defaultExtension: 'js' }, 'rxjs': { main: 'index.js', defaultExtension: 'js' }, 'rxjs/operators': { main: 'index.js', defaultExtension: 'js' }, 'devextreme-angular': { main: 'index.js', defaultExtension: 'js' } } });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.6/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.6/css/dx.light.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/zone.js@0.6.25/dist/zone.js"></script> <script src="https://unpkg.com/reflect-metadata@0.1.3/Reflect.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></script> <script src="config.js"></script> <script> System.import('app').catch(console.error.bind(console)); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <demo-app>Loading...</demo-app> </div> </body> </html>