Skip to content

Commit 3dc4e96

Browse files
Merge pull request #3801 from syncfusion-content/Migrate-Toolkit-DateTimeCategory-axis-UG-to-internal-UG-hotfix-2
982970-Migrate toolkit date time category axis and Empty points ug to internal ug hotfix
2 parents c5930ef + cde2eb0 commit 3dc4e96

File tree

12 files changed

+339
-1
lines changed

12 files changed

+339
-1
lines changed
49.3 KB
Loading
23.4 KB
Loading

MAUI/Cartesian-Charts/Axis/Types.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Cartesian chart supports the following types of chart axis.
1515
* NumericalAxis
1616
* CategoryAxis
1717
* DateTimeAxis
18+
* DateTimeCategoryAxis
1819
* LogarithmicAxis
1920

2021
## Numerical Axis
@@ -417,6 +418,78 @@ this.Content = chart;
417418

418419
![DateTimeAxis range customization support in MAUI Chart](Axis_Images/maui_chart_datetime_axis_range.jpg)
419420

421+
## DateTimeCategoryAxis
422+
423+
The `DateTimeCategoryAxis` is a specialized type of axis primarily used with financial series. Similar to the [CategoryAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.CategoryAxis.html), all data points are plotted with equal spacing, eliminating gaps for missing dates. The intervals and ranges for this axis are calculated similarly to the [DateTimeAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.DateTimeAxis.html). There are no visual gaps between points, even if the difference between two points exceeds a year.
424+
425+
{% tabs %}
426+
427+
{% highlight xaml %}
428+
429+
<chart:SfCartesianChart>
430+
. . .
431+
<chart:SfCartesianChart.XAxes>
432+
<chart:DateTimeCategoryAxis/>
433+
</chart:SfCartesianChart.XAxes>
434+
. . .
435+
</chart:SfCartesianChart>
436+
437+
{% endhighlight %}
438+
439+
{% highlight c# %}
440+
441+
SfCartesianChart chart = new SfCartesianChart();
442+
. . .
443+
// Create an instance of the DateTimeCategoryAxis, used for displaying DateTime values as categories
444+
DateTimeCategoryAxis primaryAxis = new DateTimeCategoryAxis();
445+
// Add the DateTimeCategoryAxis instance to the chart's XAxes collection
446+
chart.XAxes.Add(primaryAxis);
447+
448+
this.Content = chart;
449+
450+
{% endhighlight %}
451+
452+
{% endtabs %}
453+
454+
![DateTimeCategory Axis support in MAUI Chart](Axis_Images/maui_dateTimeCategory_axis.png)
455+
456+
### Interval
457+
458+
In `DateTimeCategoryAxis`, intervals can be customized by using the Interval and IntervalType properties, similar to [DateTimeAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.DateTimeAxis.html). For example, setting `Interval` as 5 and `IntervalType` as `Days` will consider 5 days as an interval.
459+
{% tabs %}
460+
461+
{% highlight xaml %}
462+
463+
<chart:SfCartesianChart>
464+
. . .
465+
<chart:SfCartesianChart.XAxes>
466+
<chart:DateTimeCategoryAxis Interval="5"
467+
IntervalType="Days"/>
468+
</chart:SfCartesianChart.XAxes>
469+
. . .
470+
</chart:SfCartesianChart>
471+
472+
{% endhighlight %}
473+
474+
{% highlight c# %}
475+
476+
SfCartesianChart chart = new SfCartesianChart();
477+
. . .
478+
DateTimeCategoryAxis primaryAxis = new DateTimeCategoryAxis()
479+
{
480+
Interval = 5,
481+
IntervalType = DateTimeIntervalType.Days
482+
};
483+
chart.XAxes.Add(primaryAxis);
484+
. . .
485+
this.Content = chart;
486+
487+
{% endhighlight %}
488+
489+
{% endtabs %}
490+
491+
![DateTimeCategoryAxis interval support in MAUI Chart](Axis_Images/maui_dateTimeCategory_interval.png)
492+
420493
## Logarithmic Axis
421494

422495
The [LogarithmicAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.LogarithmicAxis.html) uses a logarithmic scale, and it is very useful in visualizing data when the given data range has a big difference. It can be used either on the x-axis or the chart's y-axis.
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
layout: post
3+
title: Empty Points in .NET MAUI Chart control | Syncfusion
4+
description: Learn here all about empty points support and its features in Syncfusion® .NET MAUI Chart (SfCartesianChart) control.
5+
platform: maui
6+
control: SfCartesianChart
7+
documentation: ug
8+
keywords: .net maui chart empty points, .net maui empty points customization, syncfusion maui chart empty points, maui chart empty points, .net maui chart empty points visualization, cartesian empty points maui, missing data handling
9+
---
10+
11+
# Empty Points in .NET MAUI Chart
12+
13+
Empty Points are used to indicate missing or null data in a series. These empty points can occur when data is unavailable, improperly formatted, or explicitly set as null or double.NaN. The chart provides options to handle and customize these empty points to enhance visualization and maintain the integrity of data representation.
14+
15+
[SfCartesianChart](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html) provides support for empty points, allowing users to handle missing data effectively.
16+
17+
The data collection that is passed to the chart can have NaN or Null values that are considered as empty points. The empty point can be defined as in the below code example.
18+
19+
{% highlight C# %}
20+
21+
ProductSales = new ObservableCollection<Model>();
22+
ProductSales.Add(new Model() { Product = "Electronics", Sales = 60 });
23+
ProductSales.Add(new Model() { Product = "Clothing", Sales = 40 });
24+
ProductSales.Add(new Model() { Product = "Groceries", Sales = double.NaN });
25+
ProductSales.Add(new Model() { Product = "Furniture", Sales = 70 });
26+
ProductSales.Add(new Model() { Product = "Toys", Sales = 30 });
27+
ProductSales.Add(new Model() { Product = "Sports", Sales = double.NaN });
28+
ProductSales.Add(new Model() { Product = "Books", Sales = 50 });
29+
30+
{% endhighlight %}
31+
32+
By default, the `EmptyPointMode` property is `None`. So the empty points will not be rendered as shown in the below.
33+
34+
![Empty Points in MAUI Chart](EmptyPoints_images/EmptyPoints_Default.png)
35+
36+
## Empty Point Mode
37+
The `EmptyPointMode` property of series specifies how empty points should be handled.
38+
39+
This property provides the following options.
40+
41+
* **None** - Empty points are not rendered. This is the default behavior.
42+
* **Zero** - Empty points will be replaced with zero.
43+
* **Average** - Empty points will be replaced with the average value of the surrounding data points.
44+
45+
The following code example shows the `EmptyPointMode` as `Zero`.
46+
47+
{% tabs %}
48+
49+
{% highlight xaml %}
50+
51+
<chart:SfCartesianChart>
52+
53+
.....
54+
<chart:LineSeries ItemsSource="{Binding ProductSales}"
55+
XBindingPath="Product"
56+
YBindingPath="Sales"
57+
EmptyPointMode="Zero">
58+
</chart:LineSeries>
59+
60+
</chart:SfCartesianChart>
61+
62+
{% endhighlight %}
63+
64+
{% highlight c# %}
65+
66+
SfCartesianChart chart = new SfCartesianChart();
67+
68+
.....
69+
LineSeries series = new LineSeries()
70+
{
71+
ItemsSource = new ViewModel().ProductSales,
72+
XBindingPath = "Product",
73+
YBindingPath = "Sales",
74+
EmptyPointMode = EmptyPointMode.Zero
75+
};
76+
77+
chart.Series.Add(series);
78+
this.Content = chart;
79+
80+
{% endhighlight %}
81+
82+
{% endtabs %}
83+
84+
![EmptyPoint Mode Zero in MAUI Chart](EmptyPoints_images/EmptyPoints_Mode_Zero.png)
85+
86+
The following code example shows the `EmptyPointMode` as `Average`.
87+
88+
{% tabs %}
89+
90+
{% highlight xaml %}
91+
92+
<chart:SfCartesianChart>
93+
94+
.....
95+
<chart:ColumnSeries ItemsSource="{Binding ProductSales}"
96+
XBindingPath="Product"
97+
YBindingPath="Sales"
98+
EmptyPointMode="Average">
99+
</chart:ColumnSeries>
100+
101+
</chart:SfCartesianChart>
102+
103+
{% endhighlight %}
104+
105+
{% highlight c# %}
106+
107+
SfCartesianChart chart = new SfCartesianChart();
108+
109+
.....
110+
ColumnSeries series = new ColumnSeries()
111+
{
112+
ItemsSource = new ViewModel().ProductSales,
113+
XBindingPath = "Product",
114+
YBindingPath = "Sales",
115+
EmptyPointMode = EmptyPointMode.Average
116+
};
117+
118+
chart.Series.Add(series);
119+
this.Content = chart;
120+
121+
{% endhighlight %}
122+
123+
{% endtabs %}
124+
125+
![EmptyPoint Mode Average in MAUI Chart](EmptyPoints_images/EmptyPoints_Mode_Average.png)
126+
127+
## Empty Point Customization
128+
The `EmptyPointSettings` property allows you to customize the appearance of empty points in a series. This enables you to adjust various visual aspects of empty points, making them more distinct from the other data points. You can modify the following properties within `EmptyPointSettings`.
129+
130+
* `Fill` - Gets or sets the fill color for the empty points.
131+
* `Stroke` - Gets or sets the stroke color for empty points.
132+
* `StrokeWidth` - Gets or sets the stroke thickness for empty points.
133+
134+
{% tabs %}
135+
136+
{% highlight xaml %}
137+
138+
<chart:SfCartesianChart>
139+
140+
.....
141+
<chart:LineSeries ItemsSource="{Binding ProductSales}"
142+
XBindingPath="Product"
143+
YBindingPath="Sales"
144+
Fill="#3068F7"
145+
StrokeWidth="2"
146+
ShowMarkers="True"
147+
ShowDataLabels="True"
148+
EmptyPointMode="Average">
149+
<chart:LineSeries.EmptyPointSettings>
150+
<chart:EmptyPointSettings Fill="Orange" StrokeWidth="2"/>
151+
</chart:LineSeries.EmptyPointSettings>
152+
</chart:LineSeries>
153+
154+
</chart:SfCartesianChart>
155+
156+
{% endhighlight %}
157+
158+
{% highlight c# %}
159+
160+
SfCartesianChart chart = new SfCartesianChart();
161+
162+
.....
163+
LineSeries series = new LineSeries()
164+
{
165+
ItemsSource = new ViewModel().ProductSales,
166+
XBindingPath = "Product",
167+
YBindingPath = "Sales",
168+
Fill = Color.FromArgb("#3068F7"),
169+
StrokeWidth = 2,
170+
ShowMarkers = true,
171+
ShowDataLabels = true,
172+
EmptyPointMode = EmptyPointMode.Average
173+
};
174+
175+
EmptyPointSettings emptypointSettings = new EmptyPointSettings()
176+
{
177+
Fill = Colors.Orange,
178+
StrokeWidth = 2
179+
};
180+
181+
series.EmptyPointSettings = emptypointSettings;
182+
183+
chart.Series.Add(series);
184+
this.Content = chart;
185+
186+
{% endhighlight %}
187+
188+
{% endtabs %}
189+
190+
![Customize EmptyPoints in MAUI Chart](EmptyPoints_images\Customize_EmptyPoints.png)
191+
192+
N> EmptyPoint support is not applicable for Histogram and BoxAndWhisker series.
12.4 KB
Loading
7.36 KB
Loading
8.25 KB
Loading
14.6 KB
Loading

MAUI/Cartesian-Charts/PlotBand.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Plot bands are classified into [NumericalPlotBand](https://help.syncfusion.com/c
2626

2727
## Numerical PlotBand
2828

29-
[NumericalPlotBands](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBand.html) are used to draw plot bands for [NumericalAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalAxis.html) and [CategoryAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.CategoryAxis.html). To add a plot band, create an instance of [NumericalPlotBandCollection](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBandCollection.html) and specify numerical value for the [Start](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBand.html#Syncfusion_Maui_Charts_NumericalPlotBand_Start) and [End](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBand.html#Syncfusion_Maui_Charts_NumericalPlotBand_End) parameter. These parameters determine the beginning and end of the plot band.
29+
[NumericalPlotBands](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBand.html) are used to draw plot bands for [NumericalAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalAxis.html), [CategoryAxis](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.CategoryAxis.html), and `DateTimeCategoryAxis`. To add a plot band, create an instance of [NumericalPlotBandCollection](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBandCollection.html) and specify numerical value for the [Start](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBand.html#Syncfusion_Maui_Charts_NumericalPlotBand_Start) and [End](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.NumericalPlotBand.html#Syncfusion_Maui_Charts_NumericalPlotBand_End) parameter. These parameters determine the beginning and end of the plot band.
3030

3131
{% tabs %}
3232

43.6 KB
Loading

0 commit comments

Comments
 (0)