Skip to content

Commit

Permalink
Merge pull request #4 from SyncfusionExamples/892143-Updated-Code-in-…
Browse files Browse the repository at this point in the history
…the-Polar-chart-sample

892143- Updated C# code in Polar chart sample
  • Loading branch information
Saravanan-Madhesh authored Jul 15, 2024
2 parents 9d257bf + 460bcdc commit 55bcb65
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 48 deletions.
11 changes: 7 additions & 4 deletions Polar_chart_sample/PolarChartSample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ public MainPage()
//polarChart.Title = new Label() { Text = "Plant Analysis", HorizontalTextAlignment = TextAlignment.Center };
//polarChart.Legend = new ChartLegend();
//polarChart.PrimaryAxis = new CategoryAxis();
//polarChart.SecondaryAxis = new NumericalAxis();
//polarChart.SecondaryAxis = new NumericalAxis()
//{
// Maximum = 100
//};

//PolarAreaSeries series1 = new PolarAreaSeries()
//PolarLineSeries series1 = new PolarLineSeries()
//{
// ItemsSource = (new ViewModel()).PlantDetails,
// XBindingPath = "Direction",
Expand All @@ -25,7 +28,7 @@ public MainPage()
// ShowDataLabels = true,
//};

//PolarAreaSeries series2 = new PolarAreaSeries()
//PolarLineSeries series2 = new PolarLineSeries()
//{
// ItemsSource = (new ViewModel()).PlantDetails,
// XBindingPath = "Direction",
Expand All @@ -35,7 +38,7 @@ public MainPage()
// ShowDataLabels = true,
//};

//PolarAreaSeries series3 = new PolarAreaSeries()
//PolarLineSeries series3 = new PolarLineSeries()
//{
// ItemsSource = (new ViewModel()).PlantDetails,
// XBindingPath = "Direction",
Expand Down
92 changes: 48 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ To create a polar chart, you can add a [PolarLineSeries](https://help.syncfusion
</chart:NumericalAxis>
</chart:SfPolarChart.SecondaryAxis>

<chart:PolarLineSeries ItemsSource="{Binding PlantDetails}" XBindingPath="Direction" YBindingPath="Tree" />
<chart:PolarLineSeries ItemsSource="{Binding PlantDetails}" XBindingPath="Direction" YBindingPath="Tree"/>

<chart:PolarLineSeries ItemsSource="{Binding PlantDetails}" XBindingPath="Direction" YBindingPath="Weed" />
<chart:PolarLineSeries ItemsSource="{Binding PlantDetails}" XBindingPath="Direction" YBindingPath="Weed"/>

<chart:PolarLineSeries ItemsSource="{Binding PlantDetails}" XBindingPath="Direction" YBindingPath="Flower" />
<chart:PolarLineSeries ItemsSource="{Binding PlantDetails}" XBindingPath="Direction" YBindingPath="Flower"/>
</chart:SfPolarChart>
```

Expand All @@ -203,23 +203,25 @@ NumericalAxis secondaryAxis = new NumericalAxis()
chart.SecondaryAxis = secondaryAxis;

//Initialize the series
PolarLineSeries series = new PolarLineSeries();
series.ItemsSource = (new ViewModel()).PlantDetails;
series.XBindingPath = "Direction";
series.YBindingPath = "Tree";
PolarLineSeries series1 = new PolarLineSeries();
series1.ItemsSource = (new ViewModel()).PlantDetails;
series1.XBindingPath = "Direction";
series1.YBindingPath = "Tree";

PolarLineSeries series = new PolarLineSeries();
series.ItemsSource = (new ViewModel()).PlantDetails;
series.XBindingPath = "Direction";
series.YBindingPath = "Weed";
PolarLineSeries series2 = new PolarLineSeries();
series2.ItemsSource = (new ViewModel()).PlantDetails;
series2.XBindingPath = "Direction";
series2.YBindingPath = "Weed";

PolarLineSeries series = new PolarLineSeries();
series.ItemsSource = (new ViewModel()).PlantDetails;
series.XBindingPath = "Direction";
series.YBindingPath = "Flower";
PolarLineSeries series3 = new PolarLineSeries();
series3.ItemsSource = (new ViewModel()).PlantDetails;
series3.XBindingPath = "Direction";
series3.YBindingPath = "Flower";

//Adding Series to the Chart Series Collection
chart.Series.Add(series);
chart.Series.Add(series1);
chart.Series.Add(series2);
chart.Series.Add(series3);
```

## Add a title
Expand Down Expand Up @@ -256,17 +258,17 @@ The [ShowDataLabels](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.
<chart:SfPolarChart>
. . .
<chart:PolarLineSeries ShowDataLabels="True">
</chart:PolarLineSeries >
</chart:PolarLineSeries>
</chart:SfPolarChart>
```

###### C#
```C#
SfPolarChart chart = new SfPolarChart()
. . .
PolarLineSeries series = new PolarLineSeries();
series.ShowDataLabels = true;
chart.Series.Add(series);
PolarLineSeries series1 = new PolarLineSeries();
series1.ShowDataLabels = true;
chart.Series.Add(series1);
```

## Enable a legend
Expand All @@ -275,7 +277,7 @@ The legend provides information about the data point displayed in the chart. The

###### Xaml
```xaml
<chart:SfPolarChart >
<chart:SfPolarChart>
. . .
<chart:SfPolarChart.Legend>
<chart:ChartLegend/>
Expand Down Expand Up @@ -309,23 +311,23 @@ chart.Legend = new ChartLegend();

###### C#
```C#
PolarLineSeries series = new PolarLineSeries();
series.ItemsSource = (new ViewModel()).PlantDetails;
series.XBindingPath = "Direction";
series.YBindingPath = "Tree";
series.Label = "Tree";

PolarLineSeries series = new PolarLineSeries();
series.ItemsSource = (new ViewModel()).PlantDetails;
series.XBindingPath = "Direction";
series.YBindingPath = "Weed";
series.Label = "Weed";

PolarLineSeries series = new PolarLineSeries();
series.ItemsSource = (new ViewModel()).PlantDetails;
series.XBindingPath = "Direction";
series.YBindingPath = "Flower";
series.Label = "Flower";
PolarLineSeries series1 = new PolarLineSeries();
series1.ItemsSource = (new ViewModel()).PlantDetails;
series1.XBindingPath = "Direction";
series1.YBindingPath = "Tree";
series1.Label = "Tree";

PolarLineSeries series2 = new PolarLineSeries();
series2.ItemsSource = (new ViewModel()).PlantDetails;
series2.XBindingPath = "Direction";
series2.YBindingPath = "Weed";
series2.Label = "Weed";

PolarLineSeries series3 = new PolarLineSeries();
series3.ItemsSource = (new ViewModel()).PlantDetails;
series3.XBindingPath = "Direction";
series3.YBindingPath = "Flower";
series3.Label = "Flower";
```

## Enable tooltip
Expand All @@ -343,8 +345,8 @@ Tooltips are used to display information about a segment when a user hovers over

###### C#
```C#
PolarLineSeries series = new PolarLineSeries();
series.EnableTooltip = true;
PolarLineSeries series1 = new PolarLineSeries();
series1.EnableTooltip = true;
```

The following code example gives you the complete code of above configurations.
Expand Down Expand Up @@ -422,7 +424,7 @@ The following code example gives you the complete code of above configurations.
};
chart.SecondaryAxis = secondaryAxis;

PolarLineSeries series = new PolarLineSeries()
PolarLineSeries series1 = new PolarLineSeries()
{
ItemsSource = (new ViewModel()).PlantDetails,
XBindingPath = "Direction",
Expand All @@ -432,7 +434,7 @@ The following code example gives you the complete code of above configurations.
ShowDataLabels="True"
};

PolarLineSeries series = new PolarLineSeries()
PolarLineSeries series2 = new PolarLineSeries()
{
ItemsSource = (new ViewModel()).PlantDetails,
XBindingPath = "Direction",
Expand All @@ -442,7 +444,7 @@ The following code example gives you the complete code of above configurations.
ShowDataLabels="True"
};

PolarLineSeries series = new PolarLineSeries()
PolarLineSeries series3 = new PolarLineSeries()
{
ItemsSource = (new ViewModel()).PlantDetails,
XBindingPath = "Direction",
Expand All @@ -452,7 +454,9 @@ The following code example gives you the complete code of above configurations.
ShowDataLabels="True"
};

chart.Series.Add(series);
chart.Series.Add(series1);
chart.Series.Add(series2);
chart.Series.Add(series3);
this.Content = chart;
}
}
Expand Down

0 comments on commit 55bcb65

Please sign in to comment.