Axis Origin & Position

By default the FlexChart places the X axis at the bottom of the plot area and the Y axis on the left. This keeps the axes outside the plot area and away from the data.

You can change this default behavior using two properties:

  • position: Specifies the position of the axis as None, Left, Top, Right, Bottom, or Auto.
  • origin: Specifies the value where the axis crosses its perpendicular axis. If speficied, origin takes precendence over position.
import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as wjChart from '@grapecity/wijmo.chart'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // create the chart let theChart = new wjChart.FlexChart('#theChart', { chartType: 'Scatter', axisY: { axisLine: true, majorGrid: false, origin: 0, majorUnit: 1, max: 1, min: -1, labels: false }, axisX: { origin: 0, min: -1, max: 1, majorUnit: 1, labels: false }, legend: { position: 'None' }, tooltip: { content: '' }, bindingX: 'x', itemsSource: getData(750), series: [ { name: 'data1', binding: 'y1' }, { name: 'data2', binding: 'y2' } ] }); theChart.palette = getRandomPalette(); } // function getRandomPalette() { let palettes = Object.getOwnPropertyNames(wjChart.Palettes) .filter(prop => typeof wjChart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return wjChart.Palettes[palettes[rand]]; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Axis Origin & Position</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="theChart"></div> </div> </body> </html> // Generate random data source export function getData(num) { let data = [], cnt = 0; for (let i = 0; cnt < num; i++) { let x = 1 - 2 * Math.random(); let y = 1 - 2 * Math.random(); if (x * x + y * y <= 1) { data.push({ x: x, y1: y, y2: 0 - y }); cnt++; } } return data; } .wj-flexchart { height: 600px; width: 600px; margin: 10px 0; } body { margin-bottom: 24pt; } 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 { DataService } from './app.data'; import * as wjChart from '@grapecity/wijmo.chart'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { data: any[]; palette: any; // constructor(@Inject(DataService) private dataService: DataService) { this.data = dataService.getData(750); this.palette = this.getRandomPalette(); } // getRandomPalette() { let palettes = Object.getOwnPropertyNames(wjChart.Palettes) .filter(prop => typeof wjChart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return wjChart.Palettes[palettes[rand]]; } } // @NgModule({ imports: [WjChartModule, 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 Axis Origin & Position</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"> <div class="form-group"> <wj-flex-chart chartType="Scatter" tooltipContent="" bindingX="x" [itemsSource]="data" [palette]="palette"> <wj-flex-chart-axis wjProperty="axisY" [axisLine]="true" [majorGrid]="false" [origin]="0" [majorUnit]="1" [max]="1" [min]="-1" [labels]="false"></wj-flex-chart-axis> <wj-flex-chart-axis wjProperty="axisX" [origin]="0" [axisLine]="true" [majorUnit]="1" [max]="1" [min]="-1" [labels]="false"></wj-flex-chart-axis> <wj-flex-chart-legend position="None"></wj-flex-chart-legend> <wj-flex-chart-series name="data1" binding="y1"></wj-flex-chart-series> <wj-flex-chart-series name="data2" binding="y2"></wj-flex-chart-series> </wj-flex-chart> </div> </div> import { Injectable } from '@angular/core'; // @Injectable() export class DataService { getData(num: number) { let data = [], cnt = 0; for(let i = 0; cnt < num; i++) { let x = 1 - 2 * Math.random(); let y = 1 - 2 * Math.random(); if(x*x + y*y <= 1) { data.push({ x: x, y1: y, y2: 0 - y }); cnt++; } } return data; } } .wj-flexchart { height: 600px; width: 600px; margin: 10px 0; } body { margin-bottom: 24pt; } <template> <div class="container-fluid"> <wj-flex-chart chartType="Scatter" tooltipContent="" bindingX="x" :itemsSource="data" :palette="palette"> <wj-flex-chart-axis wjProperty="axisY" :axisLine="true" :majorGrid="false" :origin="0" :majorUnit="1" :max="1" :min="-1" :labels="false"></wj-flex-chart-axis> <wj-flex-chart-axis wjProperty="axisX" :origin="0" :axisLine="true" :majorUnit="1" :max="1" :min="-1" :labels="false"></wj-flex-chart-axis> <wj-flex-chart-legend position="None"></wj-flex-chart-legend> <wj-flex-chart-series name="data1" binding="y1"></wj-flex-chart-series> <wj-flex-chart-series name="data2" binding="y2"></wj-flex-chart-series> </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 { getData } from './data'; import * as wjChart from '@grapecity/wijmo.chart'; let App = Vue.extend({ name: 'app', data: function () { return { data: getData(750), palette: this.getRandomPalette() } }, methods: { getRandomPalette: function() { let palettes = Object.getOwnPropertyNames(wjChart.Palettes) .filter(prop => typeof wjChart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return wjChart.Palettes[palettes[rand]]; } } }) new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> .container .wj-flexchart { height: 600px; width: 600px; margin: 10px 0; } body { margin-bottom: 24px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Axis Origin & Position</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> export function getData(num) { let data = [], cnt = 0; for(let i = 0; cnt < num; i++) { let x = 1 - 2 * Math.random(); let y = 1 - 2 * Math.random(); if(x*x + y*y <= 1) { data.push({ x: x, y1: y, y2: 0 - y }); cnt++; } } return data; } 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 Chart from '@grapecity/wijmo.react.chart'; import * as wjChart from '@grapecity/wijmo.chart'; import { getData } from './data'; // class App extends React.Component { constructor(props) { super(props); this.state = { data: getData(750), palette: this.getRandomPalette() }; } render() { return <div className="container"> <div className="form-group"> <Chart.FlexChart palette={this.state.palette} itemsSource={this.state.data} chartType="Scatter" tooltipContent="" bindingX="x"> <Chart.FlexChartAxis wjProperty="axisY" axisLine={true} majorGrid={false} origin={0} majorUnit={1} max={1} min={-1} labels={false}> </Chart.FlexChartAxis> <Chart.FlexChartAxis wjProperty="axisX" axisLine={true} majorGrid={false} origin={0} majorUnit={1} max={1} min={-1} labels={false}> </Chart.FlexChartAxis> <Chart.FlexChartLegend position="None"></Chart.FlexChartLegend> <Chart.FlexChartSeries name="data1" binding="y1"></Chart.FlexChartSeries> <Chart.FlexChartSeries name="data2" binding="y2"></Chart.FlexChartSeries> </Chart.FlexChart> </div> </div>; } getRandomPalette() { let palettes = Object.getOwnPropertyNames(wjChart.Palettes) .filter(prop => typeof wjChart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return wjChart.Palettes[palettes[rand]]; } } 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 OLAP Pivot Chart Overview</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> .container .wj-flexchart { height: 600px; width: 600px; margin: 10px 0; } body { margin-bottom: 24px; } export function getData(num) { let data = [], cnt = 0; for (let i = 0; cnt < num; i++) { let x = 1 - 2 * Math.random(); let y = 1 - 2 * Math.random(); if (x * x + y * y <= 1) { data.push({ x: x, y1: y, y2: 0 - y }); cnt++; } } return data; }