Selectable Slices

The FlexPie control allows you to select data points by clicking or touching a pie slice. Use the selectionMode property to specify whether you want to allow selection by data point or no selection at all (default).

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as chart from '@grapecity/wijmo.chart'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { let pie = new chart.FlexPie('#chart', { header: 'Best-selling Mobile Phones Brands of 2017', bindingName: 'brand', binding: 'sales', selectionMode: chart.SelectionMode.Point, selectedItemPosition: chart.Position.Top, selectedItemOffset: 0.2, isAnimated: true, dataLabel: { content: '{value}M' }, tooltip: { content: '' }, itemsSource: getData(), palette: ['rgba(156,136,217,1)', 'rgba(163,215,103,1)', 'rgba(142,195,192,1)', 'rgba(233,195,169,1)', 'rgba(145,171,54,1)', 'rgba(212,204,192,1)', 'rgba(97,187,216,1)', 'rgba(226,215,111,1)', 'rgba(128,113,90,1)'] }); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Selectable Slices</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> // best selling mobile phones brands // https://en.wikipedia.org/wiki/List_of_best-selling_mobile_phones export function getData() { return [ { brand: 'Samsung', sales: 321 }, { brand: 'Apple', sales: 215 }, { brand: 'Huawei', sales: 160 }, { brand: 'OPPO', sales: 112 }, { brand: 'Vivo', sales: 100 }, { brand: 'Others', sales: 638 } ]; } 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 { 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, 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 Selectable Slices</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-pie header="Best-selling Mobile Phones Brands of 2017" bindingName="brand" binding="sales" tooltipContent="" labelContent="{value}M" selectionMode="Point" selectedItemPosition="Top" [selectedItemOffset]="0.2" [isAnimated]="true" [itemsSource]="data" [palette]="['rgba(156,136,217,1)', 'rgba(163,215,103,1)', 'rgba(142,195,192,1)', 'rgba(233,195,169,1)', 'rgba(145,171,54,1)', 'rgba(212,204,192,1)', 'rgba(97,187,216,1)', 'rgba(226,215,111,1)', 'rgba(128,113,90,1)']"> </wj-flex-pie> </div> import { Injectable } from '@angular/core'; // @Injectable() export class DataService { // best selling mobile phones brands // https://en.wikipedia.org/wiki/List_of_best-selling_mobile_phones getData() { return [ { brand: 'Samsung', sales: 321 }, { brand: 'Apple', sales: 215 }, { brand: 'Huawei', sales: 160 }, { brand: 'OPPO', sales: 112 }, { brand: 'Vivo', sales: 100 }, { brand: 'Others', sales: 638 } ]; } } body { margin-bottom: 24px; } <template> <div class="container-fluid"> <wj-flex-pie header="Best-selling Mobile Phones Brands of 2017" bindingName="brand" binding="sales" tooltipContent="" labelContent="{value}M" selectionMode="Point" selectedItemPosition="Top" :selectedItemOffset="0.2" :isAnimated="true" :itemsSource="data" :palette="['rgba(156,136,217,1)', 'rgba(163,215,103,1)', 'rgba(142,195,192,1)', 'rgba(233,195,169,1)', 'rgba(145,171,54,1)', 'rgba(212,204,192,1)', 'rgba(97,187,216,1)', 'rgba(226,215,111,1)', 'rgba(128,113,90,1)']"> </wj-flex-pie> </div> </template> <script> import '@grapecity/wijmo.styles/wijmo.css'; import 'bootstrap.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.chart'; import { getData } from './data'; // new Vue({ el: '#app', data: { data: getData() } }); </script> <style> 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 Selectable Slices</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> // best selling mobile phones brands // https://en.wikipedia.org/wiki/List_of_best-selling_mobile_phones export function getData() { return [ { brand: 'Samsung', sales: 321 }, { brand: 'Apple', sales: 215 }, { brand: 'Huawei', sales: 160 }, { brand: 'OPPO', sales: 112 }, { brand: 'Vivo', sales: 100 }, { brand: 'Others', sales: 638 } ]; } 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 { getData } from './data'; // class App extends React.Component { constructor(props) { super(props); this.initPie = (sender) => { sender.dataLabel.content = "{value}M"; sender.tooltip.content = ""; }; this.state = { data: getData(), palette: ['rgba(156,136,217,1)', 'rgba(163,215,103,1)', 'rgba(142,195,192,1)', 'rgba(233,195,169,1)', 'rgba(145,171,54,1)', 'rgba(212,204,192,1)', 'rgba(97,187,216,1)', 'rgba(226,215,111,1)', 'rgba(128,113,90,1)'] }; } render() { return <div className="container-fluid"> <wjChart.FlexPie header="Best-selling Mobile Phones Brands of 2017" bindingName="brand" binding="sales" selectionMode="Point" selectedItemPosition="Top" selectedItemOffset={0.2} isAnimated={true} initialized={this.initPie} itemsSource={this.state.data} palette={this.state.palette}> </wjChart.FlexPie> </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 Selectable Slices</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; } export function getData() { return [ { brand: 'Samsung', sales: 321 }, { brand: 'Apple', sales: 215 }, { brand: 'Huawei', sales: 160 }, { brand: 'OPPO', sales: 112 }, { brand: 'Vivo', sales: 100 }, { brand: 'Others', sales: 638 } ]; }