# FlexRadar 101

This page shows how to get started with Wijmo's FlexRadar control.

## Getting Started

Steps for getting started with the FlexRadar control in JavaScript applications:

1. Add references to Wijmo.
2. Add markup to serve as the Wijmo control's host.
3. Initialize the Wijmo control(s) via JavaScript.
4. (Optional) Add some CSS to customize the input control's appearance.

<!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="css/bootstrap.css" /> <link rel="stylesheet" type="text/css" href="css/wijmo.css" /> <link rel="stylesheet" type="text/css" href="css/app.css"/> <!-- Angular 2 --/> <!-- Polyfill(s) for older browsers --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/reflect-metadata/Reflect.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <!-- Configure SystemJS --> <script src="systemjs.config.js"></script> <!-- JQuery/Bootstrap --> <script src="bin/Devel/external/jquery.js" type="text/javascript"></script> <script src="bin/Devel/external/bootstrap.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="bin/Devel/external/bootstrap/css/bootstrap.css" /> <script src="scripts/wijmo.js" type="text/javascript"/></script/> <script src="scripts/wijmo.input.js" type="text/javascript"/></script/> <script src="scripts/wijmo.chart.js" type="text/javascript"/></script/> <script src="scripts/wijmo.chart.radar.js" type="text/javascript"/></script/> <script src="scripts/wijmo.chart.animation.js" type="text/javascript"/></script/> <script src="scripts/wijmo.angular2.js" type="text/javascript"/></script/> <!-- Load the root application module --> <script> System.import('./src/app'); </script> </head> <body> <!-- Add root application component --> <app-cmp> <wj-flex-radar [itemsSource]="basicData" bindingX="country"> <wj-flex-radar-series name="Sales" binding="sales"></wj-flex-radar-series> <wj-flex-radar-series name="Downloads" binding="downloads"></wj-flex-radar-series> <wj-flex-radar-axis wjProperty="axisY" [min]="0" [max]="100"></wj-flex-radar-axis> </wj-flex-radar> </app-cmp> </body> </html>
import { Injectable } from '@angular/core'; // Common data service @Injectable() export class DataSvc { getData(): any[] { var data = [], countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','); // populate itemsSource for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], downloads: Math.ceil(Math.random() * 80) + 20, sales: Math.ceil(Math.random() * 80) + 20 }); } return data; } } --------------------Component----------------------- // Angular import * as wjcChartRadar from 'wijmo/wijmo.chart.radar'; import * as wjcInput from 'wijmo/wijmo.input'; import { Component, EventEmitter, Input, Inject, enableProdMode, ViewChild, NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjChartModule } from 'wijmo/wijmo.angular2.chart'; import { WjChartRadarModule } from 'wijmo/wijmo.angular2.chart.radar'; import { WjChartAnimationModule } from 'wijmo/wijmo.angular2.chart.animation'; import { WjInputModule } from 'wijmo/wijmo.angular2.input'; import { TabsModule } from './components/AppTab'; import { DataSvc } from './services/DataSvc'; // The Explorer application root component. @Component({ selector: 'app-cmp', templateUrl: 'src/app.html' }) export class AppCmp { // generate some random data basicData: any[]; protected dataSvc: DataSvc; constructor( @Inject(DataSvc) dataSvc: DataSvc) { this.dataSvc = dataSvc; this.basicData = this.dataSvc.getData(); } } @NgModule({ imports: [WjInputModule, WjChartModule, WjChartRadarModule, WjChartAnimationModule, BrowserModule, FormsModule, TabsModule], declarations: [AppCmp], providers: [DataSvc], bootstrap: [AppCmp] }) export class AppModule { } enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule);
/* set default chart style */ .wj-flexchart { height: 400px; background-color: white; box-shadow: 4px 4px 10px 0px rgba(50, 50, 50, 0.75); padding: 8px; margin-bottom: 12px; display:block; }

#### Result (live):

## Basic Features

The FlexRadar control has some basic properties that allow you to customize its layout and appearance:

- chartType: Specifies the control's chart type.
- startAngle: Starting at the 12 o'clock position, specifies the angle to start drawing radar.
- totalAngle: Specifies the total angle to draw radar.
- reversed: Determines whether the control should draw radar clockwise (false) or counterclockwise (true).
- stacking: Determines whether and how the series objects are stacked.

The example below allows you to see what happens when you change these properties.

<wj-flex-radar [itemsSource]="basicData" bindingX="country" [chartType]="basicChartType" [totalAngle]="basicTotalAngle" [startAngle]="basicStartAngle" [stacking]="basicStacking" [reversed]="basicReversed" [labelContent]="showDataLabel ? '{y}' : ''"> <wj-flex-radar-series name="Sales" binding="sales"></wj-flex-radar-series> <wj-flex-radar-series name="Downloads" binding="downloads"></wj-flex-radar-series> </wj-flex-radar> <div class="form-horizontal"> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <wj-menu header="Chart Type" [(value)]="basicChartType"> <wj-menu-item value="Line">Line</wj-menu-item> <wj-menu-item value="LineSymbols">LineSymbols</wj-menu-item> <wj-menu-item value="Area">Area</wj-menu-item> <wj-menu-item value="Scatter">Scatter</wj-menu-item> <wj-menu-item value="Column">Column</wj-menu-item> </wj-menu> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <wj-menu header="Stacking" [(value)]="basicStacking"> <wj-menu-item value="None">None</wj-menu-item> <wj-menu-item value="Stacked">Stacked</wj-menu-item> <wj-menu-item value="Stacked100pc">Stacked100pc</wj-menu-item> </wj-menu> </div> </div> <div class="form-group"> <label class="col-md-3 control-label">Start Angle</label> <div class="col-md-9"> <wj-input-number #iptBasicStartAngle (valueChanged)="basicStartAngleChanged(iptBasicStartAngle)" [min]="0" [max]="360" [step]="60"> </wj-input-number> </div> </div> <div class="form-group"> <label class="col-md-3 control-label">Total Angle</label> <div class="col-md-9"> <wj-input-number #iptBasicTotalAngle (valueChanged)="basicTotalAngleChanged(iptBasicTotalAngle)" [value]="360" [min]="90" [max]="360" [step]="90"> </wj-input-number> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <div class="checkbox"> <label> <input type="checkbox" [(ngModel)]="basicReversed"> Reversed? </label> </div> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <div class="checkbox"> <label> <input type="checkbox" [(ngModel)]="showDataLabel"> Show DataLabel? </label> </div> </div> </div> </div>
export class AppCmp { basicData: any[]; protected dataSvc: DataSvc; basicChartType = 'Line'; basicTotalAngle = 360; basicStartAngle = 0; basicStacking = 'None'; basicReversed = false; constructor( @Inject(DataSvc) dataSvc: DataSvc) { this.dataSvc = dataSvc; this.basicData = this.dataSvc.getData(); } basicStartAngleChanged = (sender: wjcInput.InputNumber) => { if (sender.value < sender.min || sender.value > sender.max) { return; } this.basicStartAngle = sender.value; }; basicTotalAngleChanged = (sender: wjcInput.InputNumber) => { if (sender.value < sender.min || sender.value > sender.max) { return; } this.basicTotalAngle = sender.value; }; }

#### Result (live):

Line LineSymbols Area Scatter Column
None Stacked Stacked100pc
Start Angle
Total Angle
Reversed?
Show DataLabel?

## Polar Basic Features

The FlexRadar control can be a polar chart if xValues are number, it has some basic properties that allow you to customize its layout and appearance:

- chartType: Specifies the control's chart type.
- startAngle: Starting at the 12 o'clock position, specifies the angle to start drawing radar.
- totalAngle: Specifies the total angle to draw radar.
- reversed: Determines whether the control should draw radar clockwise (false) or counterclockwise (true).
- stacking: Determines whether and how the series objects are stacked.

The example below allows you to see what happens when you change these properties.

<wj-flex-radar [itemsSource]="basicPolarData" bindingX="longitude" [chartType]="polarChartType" [totalAngle]="polarTotalAngle" [startAngle]="polarStartAngle" [stacking]="polarStacking" [reversed]="polarReversed"> <wj-flex-radar-series name="Latitude1" binding="latitude1"></wj-flex-radar-series> <wj-flex-radar-series name="Latitude2" binding="latitude2"></wj-flex-radar-series> </wj-flex-radar> <div class="form-horizontal"> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <wj-menu header="Chart Type" [(value)]="polarChartType"> <wj-menu-item value="Line">Line</wj-menu-item> <wj-menu-item value="LineSymbols">LineSymbols</wj-menu-item> <wj-menu-item value="Area">Area</wj-menu-item> <wj-menu-item value="Scatter">Scatter</wj-menu-item> </wj-menu> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <wj-menu header="Stacking" [(value)]="polarStacking"> <wj-menu-item value="None">None</wj-menu-item> <wj-menu-item value="Stacked">Stacked</wj-menu-item> <wj-menu-item value="Stacked100pc">Stacked100pc</wj-menu-item> </wj-menu> </div> </div> <div class="form-group"> <label class="col-md-3 control-label">Start Angle</label> <div class="col-md-9"> <wj-input-number #iptPolarStartAngle (valueChanged)="polarStartAngleChanged(iptPolarStartAngle)" [min]="0" [max]="360" [step]="60"> </wj-input-number> </div> </div> <div class="form-group"> <label class="col-md-3 control-label">Total Angle</label> <div class="col-md-9"> <wj-input-number #iptPolarTotalAngle (valueChanged)="PolarTotalAngleChanged(iptPolarTotalAngle)" [value]="360" [min]="90" [max]="360" [step]="90"> </wj-input-number> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <div class="checkbox"> <label> <input type="checkbox" [(ngModel)]="polarReversed"> Reversed? </label> </div> </div> </div> </div>
export class AppCmp { basicPolarData: any[]; protected dataSvc: DataSvc; polarChartType = 'Line'; polarTotalAngle = 360; polarStartAngle = 0; polarStacking = 'None'; polarReversed = false; constructor( @Inject(DataSvc) dataSvc: DataSvc) { this.dataSvc = dataSvc; this.basicPolarData = this.dataSvc.getData(); } polarStartAngleChanged = (sender: wjcInput.InputNumber) => { if (sender.value < sender.min || sender.value > sender.max) { return; } this.polarStartAngle = sender.value; }; polarTotalAngleChanged = (sender: wjcInput.InputNumber) => { if (sender.value < sender.min || sender.value > sender.max) { return; } this.polarTotalAngle = sender.value; }; }

#### Result (live):

Line LineSymbols Area Scatter
None Stacked Stacked100pc
Start Angle
Total Angle
Reversed?

## Animation

The FlexRadar control works with ChartAnimation.

You can use different animation modes for FlexRadar control by setting the animationMode property of the ChartAnimation.

<wj-flex-radar [itemsSource]="basicPolarData" bindingX="longitude" [chartType]="polarChartType" [totalAngle]="polarTotalAngle" [startAngle]="polarStartAngle" [stacking]="polarStacking" [reversed]="polarReversed"> <wj-flex-radar-series name="Latitude1" binding="latitude1"></wj-flex-radar-series> <wj-flex-radar-series name="Latitude2" binding="latitude2"></wj-flex-radar-series> </wj-flex-radar> <div class="form-horizontal"> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <wj-menu header="Chart Type" [(value)]="polarChartType"> <wj-menu-item value="Line">Line</wj-menu-item> <wj-menu-item value="LineSymbols">LineSymbols</wj-menu-item> <wj-menu-item value="Area">Area</wj-menu-item> <wj-menu-item value="Scatter">Scatter</wj-menu-item> </wj-menu> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <wj-menu header="Stacking" [(value)]="polarStacking"> <wj-menu-item value="None">None</wj-menu-item> <wj-menu-item value="Stacked">Stacked</wj-menu-item> <wj-menu-item value="Stacked100pc">Stacked100pc</wj-menu-item> </wj-menu> </div> </div> <div class="form-group"> <label class="col-md-3 control-label">Start Angle</label> <div class="col-md-9"> <wj-input-number #iptPolarStartAngle (valueChanged)="polarStartAngleChanged(iptPolarStartAngle)" [min]="0" [max]="360" [step]="60"> </wj-input-number> </div> </div> <div class="form-group"> <label class="col-md-3 control-label">Total Angle</label> <div class="col-md-9"> <wj-input-number #iptPolarTotalAngle (valueChanged)="PolarTotalAngleChanged(iptPolarTotalAngle)" [value]="360" [min]="90" [max]="360" [step]="90"> </wj-input-number> </div> </div> <div class="form-group"> <div class="col-md-offset-3 col-md-9"> <div class="checkbox"> <label> <input type="checkbox" [(ngModel)]="polarReversed"> Reversed? </label> </div> </div> </div> </div>
export class AppCmp { basicPolarData: any[]; protected dataSvc: DataSvc; polarChartType = 'Line'; polarTotalAngle = 360; polarStartAngle = 0; polarStacking = 'None'; polarReversed = false; constructor( @Inject(DataSvc) dataSvc: DataSvc) { this.dataSvc = dataSvc; this.basicPolarData = this.dataSvc.getData(); } polarStartAngleChanged = (sender: wjcInput.InputNumber) => { if (sender.value < sender.min || sender.value > sender.max) { return; } this.polarStartAngle = sender.value; }; polarTotalAngleChanged = (sender: wjcInput.InputNumber) => { if (sender.value < sender.min || sender.value > sender.max) { return; } this.polarTotalAngle = sender.value; }; }

#### Result (live):

Line LineSymbols Area Scatter Column
Point Series All
Linear Swing EaseInQuad EaseOutQuad EaseInOutQuad EaseInCubic EaseOutCubic EaseInOutCubic EaseInQuart EaseOutQuart EaseInOutQuart EaseInQuint EaseOutQuint EaseInOutQuint EaseInSine EaseOutSine EaseInOutSine EaseInExpo EaseOutExpo EaseInOutExpo EaseInCirc EaseOutCirc EaseInOutCirc EaseInBack EaseOutBack EaseInOutBack EaseInBounce EaseOutBounce EaseInOutBounce EaseInElastic EaseOutElastic EaseInOutElastic
Duration
Is Polar Chart?