Angular PolarChart API
The PolarChart widget visualizes data in a polar coordinate system. In this system, each point on a plane is determined by the distance from the center (the point's value) and the angle from a fixed direction (the point's argument). To understand how a chart is displayed in a polar coordinate system, imagine how it would be displayed in a rectangular coordinate system and then round off the argument axis in your mind.
DevExtreme widgets are integrated with many popular libraries and frameworks. See the Installation section (for JavaScript libraries) or the Prerequisites and Installation section (for ASP.NET MVC framework) to find details on setting up DevExtreme with a particular library or framework.
The following code shows how to create the PolarChart widget using every supported library and framework. For more details on working with widgets in these libraries and frameworks, see the Widget Basics topic for jQuery, Angular, AngularJS, Knockout or ASP.NET MVC.
jQuery
var temperature = [ { month: "January", day: 6, night: 2 }, { month: "February", day: 7, night: 2 }, { month: "March", day: 10, night: 3 }, { month: "April", day: 14, night: 5 }, { month: "May", day: 18, night: 8 }, { month: "June", day: 21, night: 11 }, { month: "July", day: 22, night: 13 }, { month: "August", day: 22, night: 13 }, { month: "September", day: 19, night: 11 }, { month: "October", day: 15, night: 8 }, { month: "November", day: 10, night: 5 }, { month: "December", day: 7, night: 3 } ]; $(function() { $("#polarChart").dxPolarChart({ dataSource: temperature, commonSeriesSettings: { argumentField: "month", type: "scatter" }, series: [ { valueField: "day", name: "Day" }, { valueField: "night", name: "Night" } ] }); });
<div id="polarChart"></div>
Angular
<dx-polar-chart [dataSource]="temperature"> <dxo-common-series-settings argumentField="month" type="scatter"> </dxo-common-series-settings> <dxi-series valueField="day" name="Day"> </dxi-series> <dxi-series valueField="night" name="Night"> </dxi-series> </dx-polar-chart>
import { DxPolarChartModule } from "devextreme-angular"; // ... export class AppComponent { temperature = [ { month: "January", day: 6, night: 2 }, { month: "February", day: 7, night: 2 }, { month: "March", day: 10, night: 3 } ]; } @NgModule({ imports: [ // ... DxPolarChartModule ], // ... })
AngularJS
<div ng-controller="DemoController"> <div dx-polar-chart="{ dataSource: temperature, commonSeriesSettings: { argumentField: 'month', type: 'scatter' }, series: [ { valueField: 'day', name: 'Day' }, { valueField: 'night', name: 'Night' } ] }"></div> </div>
angular.module('DemoApp', ['dx']) .controller("DemoController", function ($scope) { $scope.temperature = [ { month: "January", day: 6, night: 2 }, { month: "February", day: 7, night: 2 }, { month: "March", day: 10, night: 3 } ]; });
Knockout
<div data-bind="dxPolarChart: { dataSource: temperature, commonSeriesSettings: { argumentField: 'month', type: 'scatter' }, series: [ { valueField: 'day', name: 'Day' }, { valueField: 'night', name: 'Night' } ] }"></div>
var viewModel = { temperature: [ { month: "January", day: 6, night: 2 }, { month: "February", day: 7, night: 2 }, { month: "March", day: 10, night: 3 } ] }; ko.applyBindings(viewModel);
ASP.NET MVC Controls
@(Html.DevExtreme().PolarChart() .ID("polarChart") .DataSource(new[] { new { Month = "January", Day = 6, Night = 2 }, new { Month = "February", Day = 7, Night = 2 }, new { Month = "March", Day = 10, Night = 3 } }) .CommonSeriesSettings(c => c .ArgumentField("Month") .Type(PolarChartSeriesType.Scatter) ) .Series(series => { series.Add().ValueField("Day"); series.Add().ValueField("Night"); }) )
@(Html.DevExtreme().PolarChart() _ .ID("polarChart") _ .DataSource({ New With { .Month = "January", .Day = 6, .Night = 2 }, New With { .Month = "February", .Day = 7, .Night = 2 }, New With { .Month = "March", .Day = 10, .Night = 3 } }) _ .CommonSeriesSettings(Sub(c) c.ArgumentField("Month") _ .Type(PolarChartSeriesType.Scatter) End Sub) _ .Series(Sub(series) series.Add().ValueField("Day") series.Add().ValueField("Night") End Sub) )
See Also
Configuration
Name | Description |
---|---|
adaptiveLayout |
Specifies adaptive layout options. |
animation |
Specifies animation options. |
argumentAxis |
Specifies argument axis options for the PolarChart widget. |
barGroupPadding |
Controls the padding and consequently the angular width of a group of bars with the same argument using relative units. Ignored if the barGroupWidth option is set. |
barGroupWidth |
Specifies a fixed angular width for groups of bars with the same argument, measured in degrees. Takes precedence over the barGroupPadding option. |
commonAxisSettings |
An object defining the configuration options that are common for all axes of the PolarChart widget. |
commonSeriesSettings |
An object defining the configuration options that are common for all series of the PolarChart widget. |
containerBackgroundColor |
Specifies the color of the parent page element. |
customizeLabel |
Customizes the appearance of an individual point label. |
customizePoint |
Customizes the appearance of an individual series point. |
dataPrepareSettings |
An object providing options for managing data from a data source. |
dataSource |
Binds the widget to data. |
disabled |
Specifies whether the widget responds to the user interaction. |
elementAttr |
Specifies the attributes to be attached to the widget's root element. |
export |
Configures the exporting and printing features. |
legend |
Specifies the options of a chart's legend. |
loadingIndicator |
Configures the loading indicator. |
margin |
Generates space around the widget. |
negativesAsZeroes |
Forces the widget to treat negative values as zeroes. Applies to stacked-like series only. |
onArgumentAxisClick |
A function that is executed when a label on the argument axis is clicked or tapped. |
onDisposing |
A function that is executed before the widget is disposed of. |
onDone |
A function that is executed when all series are ready. |
onDrawn |
A function that is executed when the widget's rendering has finished. |
onExported |
A function that is executed after the widget is exported. |
onExporting |
A function that is executed before the widget is exported. |
onFileSaving |
A function that is executed before a file with exported widget is saved to the user's local storage. |
onIncidentOccurred |
A function that is executed when an error or warning occurs. |
onInitialized |
A function used in JavaScript frameworks to save the widget instance. |
onLegendClick |
A function that is executed when a legend item is clicked or tapped. |
onOptionChanged |
A function that is executed after a widget option is changed. |
onPointClick |
A function that is executed when a series point is clicked or tapped. |
onPointHoverChanged |
A function that is executed after the pointer enters or leaves a series point. |
onPointSelectionChanged |
A function that is executed when a series point is selected or selection is canceled. |
onSeriesClick |
A function that is executed when a series is clicked or tapped. |
onSeriesHoverChanged |
A function that is executed after the pointer enters or leaves a series. |
onSeriesSelectionChanged |
A function that is executed when a series is selected or selection is canceled. |
onTooltipHidden |
A function that is executed when a tooltip becomes hidden. |
onTooltipShown |
A function that is executed when a tooltip appears. |
palette |
Sets the palette to be used for colorizing series and their elements. |
paletteExtensionMode |
Specifies what to do with colors in the palette when their number is less than the number of series (in the Chart widget) or points in a series (in the PieChart widget). |
pathModified |
Notifies the widget that it is embedded into an HTML page that uses a tag modifying the path. |
pointSelectionMode |
Specifies whether a single point or multiple points can be selected in the chart. |
redrawOnResize |
Specifies whether to redraw the widget when the size of the parent browser window changes or a mobile device rotates. |
resolveLabelOverlapping |
Specifies how the chart must behave when series point labels overlap. |
rtlEnabled |
Switches the widget to a right-to-left representation. |
series |
Specifies options for PolarChart widget series. |
seriesSelectionMode |
Specifies whether a single series or multiple series can be selected in the chart. |
seriesTemplate |
Defines options for the series template. |
size |
Specifies the widget's size in pixels. |
theme |
Sets the name of the theme the widget uses. |
title |
Configures the widget's title. |
tooltip |
Configures tooltips. |
useSpiderWeb |
Indicates whether or not to display a "spider web". |
valueAxis |
Specifies value axis options for the PolarChart widget. |
Methods
Name | Description |
---|---|
beginUpdate() |
Prevents the widget from refreshing until the endUpdate() method is called. |
clearSelection() |
Deselects the chart's selected series. The series is displayed in an initial style. |
dispose() |
Disposes of all the resources allocated to the PolarChart instance. |
element() |
Gets the root widget element. |
endUpdate() |
Refreshes the widget after a call of the beginUpdate() method. |
exportTo(fileName, format) |
Exports the widget. |
getAllSeries() |
Gets all the series. |
getDataSource() |
Gets the DataSource instance. |
getInstance(element) |
Gets the instance of a widget found using its DOM node. |
getSeriesByName(seriesName) |
Gets a series with a specific name. |
getSeriesByPos(seriesIndex) |
Gets a series with a specific index. |
getSize() |
Gets the current widget size. |
hideLoadingIndicator() |
Hides the loading indicator. |
hideTooltip() |
Hides all widget tooltips. |
instance() |
Gets the widget's instance. Use it to access other methods of the widget. |
off(eventName) |
Detaches all event handlers from a single event. |
off(eventName, eventHandler) |
Detaches a particular event handler from a single event. |
on(eventName, eventHandler) |
Subscribes to an event. |
on(events) |
Subscribes to events. |
option() |
Gets all widget options. |
option(optionName) |
Gets the value of a single option. |
option(optionName, optionValue) |
Updates the value of a single option. |
option(options) |
Updates the values of several options. |
print() |
Opens the browser's print window. |
refresh() |
Reloads data and repaints the widget. |
render() |
Redraws the widget. |
render(renderOptions) |
Redraws the widget. |
showLoadingIndicator() |
Shows the loading indicator. |
svg() |
Gets the widget's SVG markup. |
Events
Name | Description |
---|---|
argumentAxisClick |
Raised when a label on the argument axis is clicked or tapped. |
disposing |
Raised before the widget is disposed of. |
done |
Raised when all series are ready. |
drawn |
Raised when the widget's rendering has finished. |
exported |
Raised after the widget is exported. |
exporting |
Raised before the widget is exported. |
fileSaving |
Raised before a file with exported widget is saved to the user's local storage. |
incidentOccurred |
Raised when an error or warning occurs. |
initialized |
Raised only once, after the widget is initialized. |
legendClick |
Raised when a legend item is clicked or tapped. |
optionChanged |
Raised after a widget option is changed. |
pointClick |
Raised when a series point is clicked or tapped. |
pointHoverChanged |
Raised after the pointer enters or leaves a series point. |
pointSelectionChanged |
Raised when a series point is selected or selection is canceled. |
seriesClick |
Raised when a series is clicked or tapped. |
seriesHoverChanged |
Raised after the pointer enters or leaves a series. |
seriesSelectionChanged |
Raised when a series is selected or selection is canceled. |
tooltipHidden |
Raised when a tooltip becomes hidden. |
tooltipShown |
Raised when a tooltip appears. |
Series Types
Name | Description |
---|---|
AreaSeries |
An object defining a series of the area type. |
BarSeries |
An object defining a series of the bar type. |
LineSeries |
An object defining a series of the line type. |
PolarChartSeries |
Specifies options for PolarChart widget series. |
ScatterSeries |
An object defining a series of the scatter type. |
StackedBarSeries |
An object defining a series of the stackedBar type. |
If you have technical questions, please create a support ticket in the DevExpress Support Center.