|
1 | 1 | --- |
2 | 2 | layout: post |
3 | | -title: Axis types in .NET MAUI Chart control | Syncfusion |
| 3 | +title: Axis types in .NET MAUI Cartesian Chart control | Syncfusion |
4 | 4 | description: Learn here all about axis types and its features in Syncfusion® .NET MAUI Chart (SfCartesianChart) control and more. |
5 | 5 | platform: maui |
6 | 6 | control: SfCartesianChart |
7 | 7 | documentation: ug |
8 | 8 | keywords: .net maui cartesian charts, .net maui axis types, cartesian chart axis types, syncfusion cartesian charts maui, maui chart axis customization, .net maui chart axis, cartesian chart axis guide maui, .net maui sfCartesianChart axis. |
9 | 9 | --- |
10 | 10 |
|
11 | | -# Types of Axis in .NET MAUI Chart |
| 11 | +# Types of Axis in .NET MAUI Cartesian Chart |
12 | 12 |
|
13 | 13 | Cartesian chart supports the following types of chart axis. |
14 | 14 |
|
15 | 15 | * NumericalAxis |
16 | 16 | * CategoryAxis |
17 | 17 | * DateTimeAxis |
| 18 | +* DateTimeCategoryAxis |
18 | 19 | * LogarithmicAxis |
19 | 20 |
|
20 | 21 | ## Numerical Axis |
@@ -417,6 +418,78 @@ this.Content = chart; |
417 | 418 |
|
418 | 419 |  |
419 | 420 |
|
| 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 | + |
| 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 | + |
| 492 | + |
420 | 493 | ## Logarithmic Axis |
421 | 494 |
|
422 | 495 | 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. |
|
0 commit comments