@@ -76,7 +76,7 @@ Now, let us define a simple data model that represents a data point on the chart
76
76
77
77
###### C#
78
78
``` C#
79
- public class PlantData
79
+ public class PlantModel
80
80
{
81
81
public string Direction { get ; set ; }
82
82
public double Tree { get ; set ; }
@@ -85,34 +85,34 @@ Now, let us define a simple data model that represents a data point on the chart
85
85
}
86
86
```
87
87
88
- Next, create a view model class and initialize a list of ` PlantData ` objects as follows.
88
+ Next, create a PlantViewModel class and initialize a list of ` PlantModel ` objects as follows.
89
89
90
90
######
91
91
``` C#
92
- public class ViewModel
92
+ public class PlantViewModel
93
93
{
94
- public List <PlantData > PlantDetails { get ; set ; }
94
+ public List <PlantModel > PlantDetails { get ; set ; }
95
95
96
- public ViewModel ()
96
+ public PlantViewModel ()
97
97
{
98
- PlantDetails = new List <PlantData >()
98
+ PlantDetails = new List <PlantModel >()
99
99
{
100
- new PlantData (){ Direction = " North" , Tree = 80 , Flower = 42 , Weed = 63 },
101
- new PlantData (){ Direction = " NorthEast" , Tree = 85 , Flower = 40 , Weed = 70 },
102
- new PlantData (){ Direction = " East" , Tree = 78 , Flower = 47 , Weed = 65 },
103
- new PlantData (){ Direction = " SouthEast" , Tree = 90 , Flower = 40 , Weed = 70 },
104
- new PlantData (){ Direction = " South" , Tree = 78 , Flower = 27 , Weed = 47 },
105
- new PlantData (){ Direction = " SouthWest" , Tree = 83 , Flower = 45 , Weed = 65 },
106
- new PlantData (){ Direction = " West" , Tree = 79 , Flower = 40 , Weed = 58 },
107
- new PlantData (){ Direction = " NorthWest" , Tree = 88 , Flower = 38 , Weed = 73 }
100
+ new PlantModel (){ Direction = " North" , Tree = 80 , Flower = 42 , Weed = 63 },
101
+ new PlantModel (){ Direction = " NorthEast" , Tree = 85 , Flower = 40 , Weed = 70 },
102
+ new PlantModel (){ Direction = " East" , Tree = 78 , Flower = 47 , Weed = 65 },
103
+ new PlantModel (){ Direction = " SouthEast" , Tree = 90 , Flower = 40 , Weed = 70 },
104
+ new PlantModel (){ Direction = " South" , Tree = 78 , Flower = 27 , Weed = 47 },
105
+ new PlantModel (){ Direction = " SouthWest" , Tree = 83 , Flower = 45 , Weed = 65 },
106
+ new PlantModel (){ Direction = " West" , Tree = 79 , Flower = 40 , Weed = 58 },
107
+ new PlantModel (){ Direction = " NorthWest" , Tree = 88 , Flower = 38 , Weed = 73 }
108
108
};
109
109
}
110
110
}
111
111
```
112
112
113
- Create a ` ViewModel ` instance and set it as the chart's ` BindingContext ` . This enables property binding from the ` ViewModel ` class.
113
+ Create a ` PlantViewModel ` instance and set it as the chart's ` BindingContext ` . This enables property binding from the ` PlantViewModel ` class.
114
114
115
- * Add the namespace of the ` ViewModel ` class to your XAML page, if you prefer to set the ` BindingContext ` in XAML.
115
+ * Add the namespace of the ` PlantViewModel ` class to your XAML page, if you prefer to set the ` BindingContext ` in XAML.
116
116
117
117
###### Xaml
118
118
``` xaml
@@ -124,14 +124,14 @@ Create a `ViewModel` instance and set it as the chart's `BindingContext`. This e
124
124
xmlns : model =" clr-namespace:ChartGettingStarted" >
125
125
126
126
<ContentPage .BindingContext>
127
- <model : ViewModel ></ model : ViewModel >
127
+ <model : PlantViewModel / >
128
128
</ContentPage .BindingContext>
129
129
</ContentPage >
130
130
```
131
131
132
132
###### C#
133
133
``` C#
134
- this .BindingContext = new ViewModel ();
134
+ this .BindingContext = new PlantViewModel ();
135
135
```
136
136
137
137
## Initialize Chart axis
@@ -162,7 +162,7 @@ chart.SecondaryAxis = secondaryAxis;
162
162
163
163
## Populate Chart with data
164
164
165
- To create a polar chart, you can add a [ PolarLineSeries] ( https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.PolarLineSeries.html?tabs=tabid-1%2Ctabid-4 ) to the polar chart [ Series] ( https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfPolarChart.html#Syncfusion_Maui_Charts_SfPolarChart_Series ) property of the chart, and then bind the ` PlantData ` property of the above ` ViewModel ` to the ` PolarLineSeries.ItemsSource ` as follows.
165
+ To create a polar chart, you can add a [ PolarLineSeries] ( https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.PolarLineSeries.html ) to the polar chart [ Series] ( https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfPolarChart.html#Syncfusion_Maui_Charts_SfPolarChart_Series ) property of the chart, and then bind the ` PlantDetails ` property of the above ` PlantViewModel ` to the ` PolarLineSeries.ItemsSource ` as follows.
166
166
167
167
* In order to plot the series, the [ XBindingPath] ( https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartSeries.html#Syncfusion_Maui_Charts_ChartSeries_XBindingPath ) and [ YBindingPath] ( https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.XYDataSeries.html#Syncfusion_Maui_Charts_XYDataSeries_YBindingPath ) properties need to be configured correctly. These properties allow the chart to retrieve values from the corresponding properties in the data model.
168
168
@@ -204,17 +204,17 @@ chart.SecondaryAxis = secondaryAxis;
204
204
205
205
// Initialize the series
206
206
PolarLineSeries series1 = new PolarLineSeries ();
207
- series1 .ItemsSource = (new ViewModel ()).PlantDetails ;
207
+ series1 .ItemsSource = (new PlantViewModel ()).PlantDetails ;
208
208
series1 .XBindingPath = " Direction" ;
209
209
series1 .YBindingPath = " Tree" ;
210
210
211
211
PolarLineSeries series2 = new PolarLineSeries ();
212
- series2 .ItemsSource = (new ViewModel ()).PlantDetails ;
212
+ series2 .ItemsSource = (new PlantViewModel ()).PlantDetails ;
213
213
series2 .XBindingPath = " Direction" ;
214
214
series2 .YBindingPath = " Weed" ;
215
215
216
216
PolarLineSeries series3 = new PolarLineSeries ();
217
- series3 .ItemsSource = (new ViewModel ()).PlantDetails ;
217
+ series3 .ItemsSource = (new PlantViewModel ()).PlantDetails ;
218
218
series3 .XBindingPath = " Direction" ;
219
219
series3 .YBindingPath = " Flower" ;
220
220
@@ -312,19 +312,19 @@ chart.Legend = new ChartLegend();
312
312
###### C#
313
313
``` C#
314
314
PolarLineSeries series1 = new PolarLineSeries ();
315
- series1 .ItemsSource = (new ViewModel ()).PlantDetails ;
315
+ series1 .ItemsSource = (new PlantViewModel ()).PlantDetails ;
316
316
series1 .XBindingPath = " Direction" ;
317
317
series1 .YBindingPath = " Tree" ;
318
318
series1 .Label = " Tree" ;
319
319
320
320
PolarLineSeries series2 = new PolarLineSeries ();
321
- series2 .ItemsSource = (new ViewModel ()).PlantDetails ;
321
+ series2 .ItemsSource = (new PlantViewModel ()).PlantDetails ;
322
322
series2 .XBindingPath = " Direction" ;
323
323
series2 .YBindingPath = " Weed" ;
324
324
series2 .Label = " Weed" ;
325
325
326
326
PolarLineSeries series3 = new PolarLineSeries ();
327
- series3 .ItemsSource = (new ViewModel ()).PlantDetails ;
327
+ series3 .ItemsSource = (new PlantViewModel ()).PlantDetails ;
328
328
series3 .XBindingPath = " Direction" ;
329
329
series3 .YBindingPath = " Flower" ;
330
330
series3 .Label = " Flower" ;
@@ -361,7 +361,7 @@ The following code example gives you the complete code of above configurations.
361
361
xmlns : model =" clr-namespace:ChartGettingStarted" >
362
362
363
363
<ContentPage .BindingContext>
364
- <model : ViewModel ></ model : ViewModel >
364
+ <model : PlantViewModel / >
365
365
</ContentPage .BindingContext>
366
366
367
367
<ContentPage .Content>
@@ -426,7 +426,7 @@ The following code example gives you the complete code of above configurations.
426
426
427
427
PolarLineSeries series1 = new PolarLineSeries ()
428
428
{
429
- ItemsSource = (new ViewModel ()).PlantDetails ,
429
+ ItemsSource = (new PlantViewModel ()).PlantDetails ,
430
430
XBindingPath = " Direction" ,
431
431
YBindingPath = " Tree" ,
432
432
Label = " Tree" ,
@@ -436,7 +436,7 @@ The following code example gives you the complete code of above configurations.
436
436
437
437
PolarLineSeries series2 = new PolarLineSeries ()
438
438
{
439
- ItemsSource = (new ViewModel ()).PlantDetails ,
439
+ ItemsSource = (new PlantViewModel ()).PlantDetails ,
440
440
XBindingPath = " Direction" ,
441
441
YBindingPath = " Weed" ,
442
442
Label = " Weed" ,
@@ -446,7 +446,7 @@ The following code example gives you the complete code of above configurations.
446
446
447
447
PolarLineSeries series3 = new PolarLineSeries ()
448
448
{
449
- ItemsSource = (new ViewModel ()).PlantDetails ,
449
+ ItemsSource = (new PlantViewModel ()).PlantDetails ,
450
450
XBindingPath = " Direction" ,
451
451
YBindingPath = " Flower" ,
452
452
Label = " Flower" ,
0 commit comments