SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
SciChart WPF ships with hundreds of WPF Chart Examples which you can browse, play with, view the source-code and even export each WPF Chart Example to a stand-alone Visual Studio solution. All of this is possible with the new and improved SciChart WPF Examples Suite, which ships as part of the SciChart WPF SDK.
Generate simple polar chart. Demonstrates how to define polar chart with line series.
The Polar Chart is not defined by a series, but actually a special Polar Axis type. Most of the SciChart RenderableSeries have been converted to work with Polar Charts.
Tips!
You can change AxisAlignment of XAxis and YAxis. You can also change the YAxis Angle using slider at the top.
Documentation Links
The C#/WPF source code for the WPF Polar Chart example is included below (Scroll down!).
Did you know you can also view the source code from one of the following sources as well?
<UserControl x:Class="SciChart.Examples.Examples.CreateSimpleChart.PolarChartExampleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="http://schemas.abtsoftware.co.uk/scichart"
Loaded="PolarChartExampleView_OnLoaded"
d:DesignHeight="400"
d:DesignWidth="600"
mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- The SciChartPolarInteractionToolbar adds zoom, zoom extents and rotate functionality -->
<!-- to the chart and is included for example purposes. -->
<!-- If you wish to know how to zoom and pan a chart then do a search for Zoom Pan in the Examples suite! -->
<ext:SciChartInteractionToolbar TargetSurface="{Binding Source={x:Reference Name=sciChart}}" >
<ext:FlyoutMenuButton Content="AXIS"
Padding="0"
Style="{StaticResource FlyoutMenuButtonStyle}">
<ext:FlyoutMenuButton.PopupContent>
<StackPanel MinWidth="150" Orientation="Vertical">
<!-- The XAxis Alignment combo -->
<TextBlock Text="XAxis Alignment" />
<ext:FlyoutSeparator />
<ComboBox x:Name="xAxisAlignment" SelectionChanged="OnXAxisAlignmentChanged" />
<!-- The YAxis Alignment combo -->
<TextBlock Margin="4,10,4,4" Text="YAxis Alignment" />
<ext:FlyoutSeparator />
<ComboBox x:Name="yAxisAlignment" SelectionChanged="OnYAxisAlignmentChanged" />
</StackPanel>
</ext:FlyoutMenuButton.PopupContent>
</ext:FlyoutMenuButton>
<ext:FlyoutMenuButton Content="FLIP"
Padding="0"
Style="{StaticResource FlyoutMenuButtonStyle}">
<ext:FlyoutMenuButton.PopupContent>
<StackPanel MinWidth="150" Orientation="Vertical">
<TextBlock Text="Flip Axis" />
<ext:FlyoutSeparator />
<!-- Flip XAxis Coordinates -->
<CheckBox Margin="4"
Content="XAxis.FlipCoordinates?"
Foreground="#999"
IsChecked="{Binding Source={x:Reference Name=xAxis}, Path=FlipCoordinates, Mode=TwoWay}" />
<!-- Flip YAxis Coordinates -->
<CheckBox Margin="4"
Content="YAxis.FlipCoordinates?"
Foreground="#999"
IsChecked="{Binding Source={x:Reference Name=yAxis}, Path=FlipCoordinates, Mode=TwoWay}" />
</StackPanel>
</ext:FlyoutMenuButton.PopupContent>
</ext:FlyoutMenuButton>
<ext:FlyoutMenuButton Content="DEG"
Padding="0"
Style="{StaticResource FlyoutMenuButtonStyle}">
<ext:FlyoutMenuButton.PopupContent>
<StackPanel MinWidth="150" Orientation="Vertical">
<TextBlock Text="Axes Angle" />
<ext:FlyoutSeparator />
<TextBlock Text="XAxis Angle" />
<!-- Change XAxis Angle -->
<Slider Maximum="500"
Minimum="-500"
Value="{Binding Source={x:Reference Name=xAxis},
Path=RotationAngle,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
<ext:FlyoutSeparator />
<TextBlock Text="YAxis Angle" />
<!-- Change YAxis Angle -->
<Slider Maximum="360"
Minimum="0"
Value="{Binding Source={x:Reference Name=yAxis},
Path=Angle,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</ext:FlyoutMenuButton.PopupContent>
</ext:FlyoutMenuButton>
</ext:SciChartInteractionToolbar>
<s:SciChartSurface Name="sciChart"
Grid.Column="1"
BorderThickness="0"
Padding="0">
<s:SciChartSurface.RenderableSeries>
<s:FastLineRenderableSeries x:Name="lineRenderSeries"
Stroke="#C4E5FC"
StrokeThickness="2">
<s:FastLineRenderableSeries.SeriesAnimation>
<s:SweepAnimation AnimationDelay="0:0:1" Duration="0:0:1"/>
</s:FastLineRenderableSeries.SeriesAnimation>
</s:FastLineRenderableSeries>
</s:SciChartSurface.RenderableSeries>
<s:SciChartSurface.XAxis>
<s:PolarXAxis Name="xAxis"
AxisTitle="Polar Chart"
BorderBrush="#93A3C5"
RotationAngle="0"
BorderThickness="0,2,0,0"
TitleFontSize="20" />
</s:SciChartSurface.XAxis>
<s:SciChartSurface.YAxis>
<s:PolarYAxis Name="yAxis" />
</s:SciChartSurface.YAxis>
<s:SciChartSurface.ChartModifier>
<s:ModifierGroup>
<s:ZoomExtentsModifier />
<s:RubberBandXyZoomModifier IsXAxisOnly="True" />
<s:MouseWheelZoomModifier XyDirection="YDirection" />
</s:ModifierGroup>
</s:SciChartSurface.ChartModifier>
</s:SciChartSurface>
</Grid>
</UserControl>
// *************************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2022. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// PolarChartExampleView.xaml.cs is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
// *************************************************************************************
using System;
using System.Windows;
using System.Windows.Controls;
using SciChart.Charting.Model.DataSeries;
using SciChart.Charting.Visuals.Axes;
using SciChart.Examples.ExternalDependencies.Data;
namespace SciChart.Examples.Examples.CreateSimpleChart
{
/// <summary>
/// Interaction logic for PolarChartExampleView.xaml
/// </summary>
public partial class PolarChartExampleView : UserControl
{
private readonly string[] axisAlignment = {"Bottom", "Top", "Left", "Right"};
public PolarChartExampleView()
{
InitializeComponent();
xAxisAlignment.ItemsSource = axisAlignment;
xAxisAlignment.SelectedItem = Enum.GetName(typeof(AxisAlignment), AxisAlignment.Bottom);
yAxisAlignment.ItemsSource = axisAlignment;
yAxisAlignment.SelectedItem = Enum.GetName(typeof(AxisAlignment), AxisAlignment.Left);
}
private void PolarChartExampleView_OnLoaded(object sender, RoutedEventArgs e)
{
var dataSeries = new XyDataSeries<double, double>();
lineRenderSeries.DataSeries = dataSeries;
var data = DataManager.Instance.GetSquirlyWave();
dataSeries.Append(data.XData, data.YData);
sciChart.ZoomExtents();
}
private void OnXAxisAlignmentChanged(object sender, SelectionChangedEventArgs e)
{
if (xAxis != null)
xAxis.AxisAlignment = (AxisAlignment) Enum.Parse(typeof(AxisAlignment), (string) e.AddedItems[0], true);
}
private void OnYAxisAlignmentChanged(object sender, SelectionChangedEventArgs e)
{
if (yAxis != null)
yAxis.AxisAlignment = (AxisAlignment) Enum.Parse(typeof(AxisAlignment), (string) e.AddedItems[0], true);
}
}
}