diff --git a/MAUI/Cartesian-Charts/Axis/Axis_Images/maui_dateTimeCategory_axis.png b/MAUI/Cartesian-Charts/Axis/Axis_Images/maui_dateTimeCategory_axis.png new file mode 100644 index 0000000000..db4e314c3d Binary files /dev/null and b/MAUI/Cartesian-Charts/Axis/Axis_Images/maui_dateTimeCategory_axis.png differ diff --git a/MAUI/Cartesian-Charts/Axis/Axis_Images/maui_dateTimeCategory_interval.png b/MAUI/Cartesian-Charts/Axis/Axis_Images/maui_dateTimeCategory_interval.png new file mode 100644 index 0000000000..ffeef6bd96 Binary files /dev/null and b/MAUI/Cartesian-Charts/Axis/Axis_Images/maui_dateTimeCategory_interval.png differ diff --git a/MAUI/Cartesian-Charts/Axis/Types.md b/MAUI/Cartesian-Charts/Axis/Types.md index be0ee5e3dd..710960818e 100644 --- a/MAUI/Cartesian-Charts/Axis/Types.md +++ b/MAUI/Cartesian-Charts/Axis/Types.md @@ -15,6 +15,7 @@ Cartesian chart supports the following types of chart axis. * NumericalAxis * CategoryAxis * DateTimeAxis +* DateTimeCategoryAxis * LogarithmicAxis ## Numerical Axis @@ -417,6 +418,78 @@ this.Content = chart; ![DateTimeAxis range customization support in MAUI Chart](Axis_Images/maui_chart_datetime_axis_range.jpg) +## DateTimeCategoryAxis + +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. + +{% tabs %} + +{% highlight xaml %} + + + . . . + + + + . . . + + +{% endhighlight %} + +{% highlight c# %} + +SfCartesianChart chart = new SfCartesianChart(); +. . . +// Create an instance of the DateTimeCategoryAxis, used for displaying DateTime values as categories +DateTimeCategoryAxis primaryAxis = new DateTimeCategoryAxis(); +// Add the DateTimeCategoryAxis instance to the chart's XAxes collection +chart.XAxes.Add(primaryAxis); + +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + +![DateTimeCategory Axis support in MAUI Chart](Axis_Images/maui_dateTimeCategory_axis.png) + +### Interval + +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. +{% tabs %} + +{% highlight xaml %} + + + . . . + + + + . . . + + +{% endhighlight %} + +{% highlight c# %} + +SfCartesianChart chart = new SfCartesianChart(); +. . . +DateTimeCategoryAxis primaryAxis = new DateTimeCategoryAxis() +{ + Interval = 5, + IntervalType = DateTimeIntervalType.Days +}; +chart.XAxes.Add(primaryAxis); +. . . +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + +![DateTimeCategoryAxis interval support in MAUI Chart](Axis_Images/maui_dateTimeCategory_interval.png) + ## Logarithmic Axis 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. diff --git a/MAUI/Cartesian-Charts/EmptyPoints.md b/MAUI/Cartesian-Charts/EmptyPoints.md new file mode 100644 index 0000000000..97d72249e0 --- /dev/null +++ b/MAUI/Cartesian-Charts/EmptyPoints.md @@ -0,0 +1,192 @@ +--- +layout: post +title: Empty Points in .NET MAUI Chart control | Syncfusion +description: Learn here all about empty points support and its features in Syncfusion® .NET MAUI Chart (SfCartesianChart) control. +platform: maui +control: SfCartesianChart +documentation: ug +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 +--- + +# Empty Points in .NET MAUI Chart + +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. + +[SfCartesianChart](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.SfCartesianChart.html) provides support for empty points, allowing users to handle missing data effectively. + +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. + +{% highlight C# %} + +ProductSales = new ObservableCollection(); +ProductSales.Add(new Model() { Product = "Electronics", Sales = 60 }); +ProductSales.Add(new Model() { Product = "Clothing", Sales = 40 }); +ProductSales.Add(new Model() { Product = "Groceries", Sales = double.NaN }); +ProductSales.Add(new Model() { Product = "Furniture", Sales = 70 }); +ProductSales.Add(new Model() { Product = "Toys", Sales = 30 }); +ProductSales.Add(new Model() { Product = "Sports", Sales = double.NaN }); +ProductSales.Add(new Model() { Product = "Books", Sales = 50 }); + +{% endhighlight %} + +By default, the `EmptyPointMode` property is `None`. So the empty points will not be rendered as shown in the below. + +![Empty Points in MAUI Chart](EmptyPoints_images/EmptyPoints_Default.png) + +## Empty Point Mode +The `EmptyPointMode` property of series specifies how empty points should be handled. + +This property provides the following options. + +* **None** - Empty points are not rendered. This is the default behavior. +* **Zero** - Empty points will be replaced with zero. +* **Average** - Empty points will be replaced with the average value of the surrounding data points. + +The following code example shows the `EmptyPointMode` as `Zero`. + +{% tabs %} + +{% highlight xaml %} + + + + ..... + + + + + +{% endhighlight %} + +{% highlight c# %} + +SfCartesianChart chart = new SfCartesianChart(); + +..... +LineSeries series = new LineSeries() +{ + ItemsSource = new ViewModel().ProductSales, + XBindingPath = "Product", + YBindingPath = "Sales", + EmptyPointMode = EmptyPointMode.Zero +}; + +chart.Series.Add(series); +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + +![EmptyPoint Mode Zero in MAUI Chart](EmptyPoints_images/EmptyPoints_Mode_Zero.png) + +The following code example shows the `EmptyPointMode` as `Average`. + +{% tabs %} + +{% highlight xaml %} + + + + ..... + + + + + +{% endhighlight %} + +{% highlight c# %} + +SfCartesianChart chart = new SfCartesianChart(); + +..... +ColumnSeries series = new ColumnSeries() +{ + ItemsSource = new ViewModel().ProductSales, + XBindingPath = "Product", + YBindingPath = "Sales", + EmptyPointMode = EmptyPointMode.Average +}; + +chart.Series.Add(series); +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + +![EmptyPoint Mode Average in MAUI Chart](EmptyPoints_images/EmptyPoints_Mode_Average.png) + +## Empty Point Customization +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`. + +* `Fill` - Gets or sets the fill color for the empty points. +* `Stroke` - Gets or sets the stroke color for empty points. +* `StrokeWidth` - Gets or sets the stroke thickness for empty points. + +{% tabs %} + +{% highlight xaml %} + + + + ..... + + + + + + + + +{% endhighlight %} + +{% highlight c# %} + +SfCartesianChart chart = new SfCartesianChart(); + +..... +LineSeries series = new LineSeries() +{ + ItemsSource = new ViewModel().ProductSales, + XBindingPath = "Product", + YBindingPath = "Sales", + Fill = Color.FromArgb("#3068F7"), + StrokeWidth = 2, + ShowMarkers = true, + ShowDataLabels = true, + EmptyPointMode = EmptyPointMode.Average +}; + +EmptyPointSettings emptypointSettings = new EmptyPointSettings() +{ + Fill = Colors.Orange, + StrokeWidth = 2 +}; + +series.EmptyPointSettings = emptypointSettings; + +chart.Series.Add(series); +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + +![Customize EmptyPoints in MAUI Chart](EmptyPoints_images\Customize_EmptyPoints.png) + +N> EmptyPoint support is not applicable for Histogram and BoxAndWhisker series. diff --git a/MAUI/Cartesian-Charts/EmptyPoints_images/Customize_EmptyPoints.png b/MAUI/Cartesian-Charts/EmptyPoints_images/Customize_EmptyPoints.png new file mode 100644 index 0000000000..9b7f2c958c Binary files /dev/null and b/MAUI/Cartesian-Charts/EmptyPoints_images/Customize_EmptyPoints.png differ diff --git a/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Default.png b/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Default.png new file mode 100644 index 0000000000..4a899e9016 Binary files /dev/null and b/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Default.png differ diff --git a/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Mode_Average.png b/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Mode_Average.png new file mode 100644 index 0000000000..4abb63c69b Binary files /dev/null and b/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Mode_Average.png differ diff --git a/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Mode_Zero.png b/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Mode_Zero.png new file mode 100644 index 0000000000..271273ea7e Binary files /dev/null and b/MAUI/Cartesian-Charts/EmptyPoints_images/EmptyPoints_Mode_Zero.png differ diff --git a/MAUI/Cartesian-Charts/PlotBand.md b/MAUI/Cartesian-Charts/PlotBand.md index 4fdeeb8ae9..2c4e15c70e 100644 --- a/MAUI/Cartesian-Charts/PlotBand.md +++ b/MAUI/Cartesian-Charts/PlotBand.md @@ -26,7 +26,7 @@ Plot bands are classified into [NumericalPlotBand](https://help.syncfusion.com/c ## Numerical PlotBand -[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. +[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. {% tabs %} diff --git a/MAUI/Polar-Charts/Axis/Axis_Images/maui_dateTimeCategory_axis.png b/MAUI/Polar-Charts/Axis/Axis_Images/maui_dateTimeCategory_axis.png new file mode 100644 index 0000000000..fbb2f72a8e Binary files /dev/null and b/MAUI/Polar-Charts/Axis/Axis_Images/maui_dateTimeCategory_axis.png differ diff --git a/MAUI/Polar-Charts/Axis/Types.md b/MAUI/Polar-Charts/Axis/Types.md index 60f6812062..4d126bd27c 100644 --- a/MAUI/Polar-Charts/Axis/Types.md +++ b/MAUI/Polar-Charts/Axis/Types.md @@ -14,6 +14,7 @@ Polar chart supports the following types of chart axis. * NumericalAxis * CategoryAxis * DateTimeAxis +* DateTimeCategoryAxis ## Numerical Axis @@ -310,6 +311,77 @@ this.Content = chart; {% endtabs %} +## DateTimeCategoryAxis + +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. + +{% tabs %} + +{% highlight xaml %} + + + . . . + + + + . . . + + +{% endhighlight %} + +{% highlight c# %} + +SfPolarChart chart = new SfPolarChart(); +. . . +// Create an instance of the DateTimeCategoryAxis, used for displaying DateTime values as categories +DateTimeCategoryAxis primaryAxis = new DateTimeCategoryAxis(); +// Add the DateTimeCategoryAxis instance to the chart's XAxes collection +chart.PrimaryAxis.Add(primaryAxis); +. . . +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + +![DateTimeCategory Axis support in MAUI Chart](Axis_Images/maui_dateTimeCategory_axis.png) + +### Interval + +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 3 and `IntervalType` as `Months` will consider 3 months as interval. + +{% tabs %} + +{% highlight xaml %} + + + . . . + + + + . . . + + +{% endhighlight %} + +{% highlight c# %} + +SfPolarChart chart = new SfPolarChart(); +. . . +DateTimeCategoryAxis primaryAxis = new DateTimeCategoryAxis() +{ + Interval = 3, + IntervalType = DateTimeIntervalType.Months +}; +chart.PrimaryAxis.Add(primaryAxis); +. . . +this.Content = chart; + +{% endhighlight %} + +{% endtabs %} + ## Inversed Axis can be inverted using the [IsInversed](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.Charts.ChartAxis.html#Syncfusion_Maui_Charts_ChartAxis_IsInversed) property. The default value of this property is `False`. diff --git a/maui-toc.html b/maui-toc.html index e75ed6fbc0..5d1e3ced76 100644 --- a/maui-toc.html +++ b/maui-toc.html @@ -394,6 +394,7 @@
  • Histogram Chart
  • +
  • Empty Points
  • Appearance
  • Plot Band
  • Annotation