You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<chart:ChartAxisTitle Text="Number of items sold" TextColor="Blue"/>
39
+
</chart:NumericalAxis.Title>
40
+
</chart:NumericalAxis>/>
38
41
</chart:SfCartesianChart.YAxes>
39
42
40
-
<chart:SplineSeries XBindingPath="XValue"
43
+
<chart:ColumnSeries XBindingPath="XValue"
41
44
YBindingPath="YValue"
42
45
ItemsSource="{Binding Data}"/>
43
46
@@ -50,48 +53,47 @@ var chart = new SfCartesianChart();
50
53
ViewModel viewModel = new ViewModel();
51
54
52
55
//Initializing new style for the axis line, grid lines, tick lines and labels.
53
-
var axisLableStyle = new ChartAxisLabelStyle { TextColor = Colors.Red };
54
-
var axisLineStyle = new ChartLineStyle { Stroke = Colors.Yellow };
55
-
var majorLineStyle = new ChartLineStyle { Stroke = Colors.Brown };
56
-
var minorLineStyle = new ChartLineStyle { Stroke = Colors.Gray };
57
-
var majorTickStyle = new ChartAxisTickStyle { Stroke = Colors.Brown };
58
-
var minorTickStyle = new ChartAxisTickStyle { Stroke = Colors.Gray };
56
+
var xAxisLableStyle = new ChartAxisLabelStyle { TextColor = Colors.Red };
57
+
var yAxisLableStyle = new ChartAxisLabelStyle { TextColor = Colors.Blue };
58
+
var majorLineStyle = new ChartLineStyle { Stroke = Colors.Gray };
59
+
var minorLineStyle = new ChartLineStyle { Stroke = Colors.Gray, StrokeDashArray = new DoubleCollection() { 2, 2 } };
60
+
var majorTickStyle = new ChartAxisTickStyle { Stroke = Colors.Gray };
61
+
var xAxisTitle = new ChartAxisTitle() { Text = "Brand", TextColor = Colors.Red,};
62
+
var yAxisTitle = new ChartAxisTitle() { Text = " Number of items sold", TextColor = Colors.Blue,};
59
63
60
64
//Initializing XAxes
61
65
var xAxis = new CategoryAxis()
62
66
{
63
-
LabelStyle = axisLableStyle,
64
-
AxisLineStyle = axisLineStyle,
65
-
MajorGridLineStyle = majorLineStyle,
66
-
MajorTickStyle = majorTickStyle,
67
+
LabelStyle = xAxisLableStyle,
68
+
Title = xAxisTitle,
69
+
ShowMajorGridLines = false,
67
70
};
68
71
chart.XAxes.Add(xAxis);
69
72
70
73
//Initializing YAxes
71
74
var yAxis = new NumericalAxis()
72
75
{
73
-
MinorTicksPerInterval = 2,
74
-
LabelStyle = axisLableStyle,
75
-
AxisLineStyle = axisLineStyle,
76
+
MinorTicksPerInterval = 2,
77
+
LabelStyle = yAxisLableStyle,
76
78
MajorGridLineStyle = majorLineStyle,
77
79
MinorGridLineStyle = minorLineStyle,
78
80
MajorTickStyle = majorTickStyle,
79
-
MinorTickStyle = minorTickStyle,
81
+
Title = yAxisTitle,
80
82
};
81
83
chart.YAxes.Add(yAxis);
82
84
83
-
var series = new SplineSeries()
85
+
var series = new ColumnSeries()
84
86
{
85
-
ItemsSource = viewModel.Data,
86
-
XBindingPath = "XValue",
87
-
YBindingPath = "YValue",
87
+
ItemsSource = viewModel.Data,
88
+
XBindingPath = "XValue",
89
+
YBindingPath = "YValue",
88
90
};
89
91
90
92
chart.Series.Add(series);
91
93
92
94
```
93
95
94
-

96
+

95
97
96
98
This user guide [Documentation](https://help.syncfusion.com/maui/cartesian-charts/getting-started) helps you to acquire more knowledge on the MAUI cartesian charts and their features. You can also refer to the [Feature Tour](https://www.syncfusion.com/maui-controls/maui-charts) site to get an overview of all the features in the chart.
0 commit comments