Skip to content

843373-Resolve build errors of chart demos from syncfusion-examples #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
# How-to-add-custom-axis-label-in-WinUI-SfCartesianChart.
This sample demonstrates how to add custom axis label in WinUI SfCartesianChart.

The appearance of the axis labels can be customized by using the LabelTemplate property of axis.

XAML
```
<chart:SfCartesianChart>
. . .
<chart:SfCartesianChart.Resources>
<DataTemplate x:Key="labelTemplate">
<Border BorderBrush="Blue"
CornerRadius="5"
BorderThickness="1">
<TextBlock Text="{Binding Content}"
FontSize="12"
FontStyle="Italic"
FontWeight="Bold"
Margin="3"/>
</Border>
</DataTemplate>
</chart:SfCartesianChart.Resources>
. . .
<chart:SfCartesianChart.XAxes>
<chart:CategoryAxis LabelTemplate="{StaticResource labelTemplate}"/>
</chart:SfCartesianChart.XAxes>

</chart:SfCartesianChart>
```
![image](https://github.com/SyncfusionExamples/How-to-add-custom-axis-label-in-WinUI-SfCartesianChart/assets/113962276/32127637-bb2e-4618-bf60-e62b91eaf8c5)

## Smart Axis Labels
When there are more number of axis labels, they may overlap with each other. Chart axis provides support to handle the overlapping axis labels using the LabelsIntersectAction property. By default the LabelsIntersectAction value is Hide.

| Action | Description |
|-------------|-----------------|
| None | Used to display all the label even if it intersects |
| Hide | Used to hide the labels if it intersects |
| MultipleRows| Used to move the labels to next row if it intersects |
| Auto | Used to rotate the labels if it intersects |

### Hide

![image](https://github.com/SyncfusionExamples/How-to-add-custom-axis-label-in-WinUI-SfCartesianChart/assets/113962276/e6c5461f-194a-421a-bda0-dbeb477f2eb7)

### MultipleRows

![image](https://github.com/SyncfusionExamples/How-to-add-custom-axis-label-in-WinUI-SfCartesianChart/assets/113962276/4b587eca-b41c-490a-b359-131d25d71e18)

### Auto

![image](https://github.com/SyncfusionExamples/How-to-add-custom-axis-label-in-WinUI-SfCartesianChart/assets/113962276/a2f06241-9acb-46d4-bf45-a970d06f014d)