Bar With Line

Each series object in the FlexChart may specify its own chartType to override the chart's default. This makes it easy to mix different chart types in a single chart. The sample shows combination bar with line chart, and multiple Y axes.

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as chart from '@grapecity/wijmo.chart'; import * as animation from '@grapecity/wijmo.chart.animation'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { let barchart = new chart.FlexChart('#chart', { header: 'Climate of New York', legend: { position: chart.Position.None }, bindingX: 'month', series: [ { binding: 'temperature', name: 'Mean Temperature' }, { binding: 'precipitation', name: 'Average Precipitation', chartType: chart.ChartType.Line } ], axisY: { axisLine: true, origin: -10, title: 'Mean Temperature (°C)' }, itemsSource: getData(), palette: ['rgba(136,189,230,1)', 'rgba(251,178,88,1)', 'rgba(144,205,151,1)', 'rgba(246,170,201,1)', 'rgba(191,165,84,1)', 'rgba(188,153,199,1)', 'rgba(237,221,70,1)', 'rgba(240,126,110,1)', 'rgba(140,140,140,1)'] }); // let ani = new animation.ChartAnimation(barchart); // // create and apply extra Y axis for 'Precipitation' series let axisY2 = new chart.Axis(); axisY2.position = chart.Position.Right; axisY2.title = 'Average Precipitation (mm)'; axisY2.axisLine = true; axisY2.min = 0; barchart.series[1].axisY = axisY2; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Bar With Line</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <div id="chart"></div> </div> </body> </html> // The climate of New York // https://en.wikipedia.org/wiki/Climate_of_New_York export function getData() { return [ { month: 'Jan', 'temperature': -5.2, 'precipitation': 65.8 }, { month: 'Feb', 'temperature': -3.4, 'precipitation': 55.9 }, { month: 'Mar', 'temperature': 1.7, 'precipitation': 81.5 }, { month: 'Apr', 'temperature': 8.8, 'precipitation': 80.5 }, { month: 'May', 'temperature': 14.6, 'precipitation': 91.7 }, { month: 'Jun', 'temperature': 19.6, 'precipitation': 96.3 }, { month: 'Jul', 'temperature': 22.1, 'precipitation': 104.6 }, { month: 'Aug', 'temperature': 21.2, 'precipitation': 87.9 }, { month: 'Sep', 'temperature': 16.6, 'precipitation': 83.8 }, { month: 'Oct', 'temperature': 9.8, 'precipitation': 93.5 }, { month: 'Nov', 'temperature': 4.3, 'precipitation': 83.6 }, { month: 'Dec', 'temperature': -1.9, 'precipitation': 74.4 } ]; } body { margin-bottom: 24px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, Inject, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjChartModule } from '@grapecity/wijmo.angular2.chart'; import { WjChartAnimationModule } from '@grapecity/wijmo.angular2.chart.animation'; import { DataService } from './app.data'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { data: any[]; // constructor(@Inject(DataService) private dataService: DataService) { this.data = dataService.getData(); } } // @NgModule({ imports: [WjChartModule, WjChartAnimationModule, BrowserModule], declarations: [AppComponent], providers: [DataService], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Bar With Line</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <wj-flex-chart [header]="'Climate of New York'" [bindingX]="'month'" [itemsSource]="data" [palette]="['rgba(136,189,230,1)', 'rgba(251,178,88,1)', 'rgba(144,205,151,1)', 'rgba(246,170,201,1)', 'rgba(191,165,84,1)', 'rgba(188,153,199,1)', 'rgba(237,221,70,1)', 'rgba(240,126,110,1)', 'rgba(140,140,140,1)']"> <wj-flex-chart-legend [position]="'None'"> </wj-flex-chart-legend> <wj-flex-chart-series [name]="'Mean Temperature'" [binding]="'temperature'"> </wj-flex-chart-series> <wj-flex-chart-series [name]="'Average Precipitation'" [binding]="'precipitation'" [chartType]="'Line'"> <wj-flex-chart-axis [wjProperty]="'axisY'" [position]="'Right'" [title]="'Average Precipitation (mm)'" [axisLine]="true" [min]="0"> </wj-flex-chart-axis> </wj-flex-chart-series> <wj-flex-chart-axis [wjProperty]="'axisY'" [axisLine]="true" [origin]="-10" [title]="'Mean Temperature (°C)'"> </wj-flex-chart-axis> <wj-flex-chart-animation></wj-flex-chart-animation> </wj-flex-chart> </div> import { Injectable } from '@angular/core'; // @Injectable() export class DataService { // The climate of New York // https://en.wikipedia.org/wiki/Climate_of_New_York getData() { return [ { month: 'Jan', temperature: -5.2, precipitation: 65.8 }, { month: 'Feb', temperature: -3.4, precipitation: 55.9 }, { month: 'Mar', temperature: 1.7, precipitation: 81.5 }, { month: 'Apr', temperature: 8.8, precipitation: 80.5 }, { month: 'May', temperature: 14.6, precipitation: 91.7 }, { month: 'Jun', temperature: 19.6, precipitation: 96.3 }, { month: 'Jul', temperature: 22.1, precipitation: 104.6 }, { month: 'Aug', temperature: 21.2, precipitation: 87.9 }, { month: 'Sep', temperature: 16.6, precipitation: 83.8 }, { month: 'Oct', temperature: 9.8, precipitation: 93.5 }, { month: 'Nov', temperature: 4.3, precipitation: 83.6 }, { month: 'Dec', temperature: -1.9, precipitation: 74.4 } ]; } } body { margin-bottom: 24px; } <template> <div class="container-fluid"> <wj-flex-chart header="Climate of New York" bindingX="month" :itemsSource="data" :palette="['rgba(136,189,230,1)', 'rgba(251,178,88,1)', 'rgba(144,205,151,1)', 'rgba(246,170,201,1)', 'rgba(191,165,84,1)', 'rgba(188,153,199,1)', 'rgba(237,221,70,1)', 'rgba(240,126,110,1)', 'rgba(140,140,140,1)']"> <wj-flex-chart-legend position="None"> </wj-flex-chart-legend> <wj-flex-chart-series name="Mean Temperature" binding="temperature"> </wj-flex-chart-series> <wj-flex-chart-series name="Average Precipitation" binding="precipitation" chartType="Line"> <wj-flex-chart-axis wjProperty="axisY" position="Right" title="Average Precipitation (mm)" :axisLine="true" :min="0"> </wj-flex-chart-axis> </wj-flex-chart-series> <wj-flex-chart-axis wjProperty="axisY" :axisLine="true" :origin="-10" title="Mean Temperature (°C)"> </wj-flex-chart-axis> <wj-flex-chart-animation></wj-flex-chart-animation> </wj-flex-chart> </div> </template> <script> import "@grapecity/wijmo.styles/wijmo.css"; import 'bootstrap.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.core'; import '@grapecity/wijmo.vue2.chart'; import '@grapecity/wijmo.vue2.chart.animation'; import { getData } from './data'; let App = Vue.extend({ name: 'app', data: function () { return { data: getData() } } }) new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> body { margin-bottom: 24px; } label { margin-right: 3px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Bar With Line</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"></div> </body> </html> // The climate of New York // https://en.wikipedia.org/wiki/Climate_of_New_York export function getData() { return [ { month: 'Jan', temperature: -5.2, precipitation: 65.8 }, { month: 'Feb', temperature: -3.4, precipitation: 55.9 }, { month: 'Mar', temperature: 1.7, precipitation: 81.5 }, { month: 'Apr', temperature: 8.8, precipitation: 80.5 }, { month: 'May', temperature: 14.6, precipitation: 91.7 }, { month: 'Jun', temperature: 19.6, precipitation: 96.3 }, { month: 'Jul', temperature: 22.1, precipitation: 104.6 }, { month: 'Aug', temperature: 21.2, precipitation: 87.9 }, { month: 'Sep', temperature: 16.6, precipitation: 83.8 }, { month: 'Oct', temperature: 9.8, precipitation: 93.5 }, { month: 'Nov', temperature: 4.3, precipitation: 83.6 }, { month: 'Dec', temperature: -1.9, precipitation: 74.4 } ]; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wjChart from '@grapecity/wijmo.react.chart'; import * as wjChartAnimate from '@grapecity/wijmo.react.chart.animation'; import { getData } from './data'; // class App extends React.Component { constructor(props) { super(props); this.state = { data: getData(), palette: ['rgba(136,189,230,1)', 'rgba(251,178,88,1)', 'rgba(144,205,151,1)', 'rgba(246,170,201,1)', 'rgba(191,165,84,1)', 'rgba(188,153,199,1)', 'rgba(237,221,70,1)', 'rgba(240,126,110,1)', 'rgba(140,140,140,1)'] }; } ; render() { return <div className="container-fluid"> <wjChart.FlexChart header="Climate of New York" bindingX="month" itemsSource={this.state.data} palette={this.state.palette}> <wjChart.FlexChartLegend position="None"> </wjChart.FlexChartLegend> <wjChart.FlexChartSeries name="Mean Temperature" binding="temperature"> </wjChart.FlexChartSeries> <wjChart.FlexChartSeries name="Average Precipitation" binding="precipitation" chartType="Line"> <wjChart.FlexChartAxis wjProperty="axisY" position="Right" title="Average Precipitation (mm)" axisLine={true} min={0}> </wjChart.FlexChartAxis> </wjChart.FlexChartSeries> <wjChart.FlexChartAxis wjProperty="axisY" axisLine={true} origin={-10} title="Mean Temperature (°C)"> </wjChart.FlexChartAxis> <wjChartAnimate.FlexChartAnimation></wjChartAnimate.FlexChartAnimation> </wjChart.FlexChart> </div>; } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Bar With Line</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> body { margin-bottom: 24px; } // Comparison of imports vs exports of the United States // https://en.wikipedia.org/wiki/Comparison_of_imports_vs_exports_of_the_United_States export function getData() { return [ { month: 'Jan', temperature: -5.2, precipitation: 65.8 }, { month: 'Feb', temperature: -3.4, precipitation: 55.9 }, { month: 'Mar', temperature: 1.7, precipitation: 81.5 }, { month: 'Apr', temperature: 8.8, precipitation: 80.5 }, { month: 'May', temperature: 14.6, precipitation: 91.7 }, { month: 'Jun', temperature: 19.6, precipitation: 96.3 }, { month: 'Jul', temperature: 22.1, precipitation: 104.6 }, { month: 'Aug', temperature: 21.2, precipitation: 87.9 }, { month: 'Sep', temperature: 16.6, precipitation: 83.8 }, { month: 'Oct', temperature: 9.8, precipitation: 93.5 }, { month: 'Nov', temperature: 4.3, precipitation: 83.6 }, { month: 'Dec', temperature: -1.9, precipitation: 74.4 } ]; }