-
Notifications
You must be signed in to change notification settings - Fork 816
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
231 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@using System.Globalization | ||
|
||
<RadzenStack class="rz-p-0 rz-p-md-6 rz-p-lg-12"> | ||
<RadzenCard Variant="Variant.Outlined"> | ||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Wrap="FlexWrap.Wrap"> | ||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem"> | ||
<RadzenLabel Text="Rotation" Component="rotation" /> | ||
<RadzenSlider @bind-Value="@rotation" Name="rotation" Min="-90" Max="90" /> | ||
<RadzenText>@(rotation)<sup>°</sup></RadzenText> | ||
</RadzenStack> | ||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem"> | ||
<RadzenLabel Text="Width" Component="width" /> | ||
<RadzenSlider @bind-Value="@width" Name="width" Min="600" Max="1200" /> | ||
<RadzenText>@(width)px</RadzenText> | ||
</RadzenStack> | ||
</RadzenStack> | ||
</RadzenCard> | ||
|
||
<RadzenChart style="@($"width: {width}px")"> | ||
<RadzenAreaSeries Smooth="true" Data="@revenue2024" CategoryProperty="Date" Title="2024" ValueProperty="Revenue"> | ||
<RadzenSeriesDataLabels Visible="@showDataLabels" /> | ||
</RadzenAreaSeries> | ||
<RadzenCategoryAxis Padding="20" LabelAutoRotation="@rotation" /> | ||
<RadzenValueAxis Formatter="@FormatAsUSD"> | ||
<RadzenGridLines Visible="true" /> | ||
<RadzenAxisTitle Text="Revenue in USD" /> | ||
</RadzenValueAxis> | ||
</RadzenChart> | ||
</RadzenStack> | ||
|
||
@code { | ||
double rotation = -45; | ||
bool showDataLabels = false; | ||
double width = 600; | ||
|
||
class DataItem | ||
{ | ||
public string Date { get; set; } | ||
public double Revenue { get; set; } | ||
} | ||
|
||
string FormatAsUSD(object value) | ||
{ | ||
return ((double)value).ToString("C0", CultureInfo.CreateSpecificCulture("en-US")); | ||
} | ||
|
||
DataItem[] revenue2024 = new DataItem[] { | ||
new DataItem { Date = "January", Revenue = 234000 }, | ||
new DataItem { Date = "February", Revenue = 269000 }, | ||
new DataItem { Date = "March", Revenue = 233000 }, | ||
new DataItem { Date = "April", Revenue = 244000 }, | ||
new DataItem { Date = "May", Revenue = 214000 }, | ||
new DataItem { Date = "June", Revenue = 253000 }, | ||
new DataItem { Date = "July", Revenue = 274000 }, | ||
new DataItem { Date = "August", Revenue = 284000 }, | ||
new DataItem { Date = "September", Revenue = 273000 }, | ||
new DataItem { Date = "October", Revenue = 282000 }, | ||
new DataItem { Date = "November", Revenue = 289000 }, | ||
new DataItem { Date = "December", Revenue = 294000 } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@using System.Globalization | ||
|
||
<RadzenStack class="rz-p-0 rz-p-md-6 rz-p-lg-12"> | ||
<RadzenCard Variant="Variant.Outlined"> | ||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Wrap="FlexWrap.Wrap"> | ||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0.5rem"> | ||
<RadzenLabel Text="Rotation" Component="rotation" /> | ||
<RadzenSlider @bind-Value="@rotation" Name="rotation" Min="-90" Max="90" /> | ||
<RadzenText>@(rotation)<sup>°</sup></RadzenText> | ||
</RadzenStack> | ||
</RadzenStack> | ||
</RadzenCard> | ||
|
||
<RadzenChart> | ||
<RadzenAreaSeries Smooth="true" Data="@revenue2024" CategoryProperty="Date" Title="2024" ValueProperty="Revenue"> | ||
<RadzenSeriesDataLabels Visible="@showDataLabels" /> | ||
</RadzenAreaSeries> | ||
<RadzenCategoryAxis Padding="20" LabelRotation="@rotation" /> | ||
<RadzenValueAxis Formatter="@FormatAsUSD"> | ||
<RadzenGridLines Visible="true" /> | ||
<RadzenAxisTitle Text="Revenue in USD" /> | ||
</RadzenValueAxis> | ||
</RadzenChart> | ||
</RadzenStack> | ||
|
||
@code { | ||
double rotation = -45; | ||
bool showDataLabels = false; | ||
|
||
class DataItem | ||
{ | ||
public string Date { get; set; } | ||
public double Revenue { get; set; } | ||
} | ||
|
||
string FormatAsUSD(object value) | ||
{ | ||
return ((double)value).ToString("C0", CultureInfo.CreateSpecificCulture("en-US")); | ||
} | ||
|
||
DataItem[] revenue2024 = new DataItem[] { | ||
new DataItem { Date = "January", Revenue = 234000 }, | ||
new DataItem { Date = "February", Revenue = 269000 }, | ||
new DataItem { Date = "March", Revenue = 233000 }, | ||
new DataItem { Date = "April", Revenue = 244000 }, | ||
new DataItem { Date = "May", Revenue = 214000 }, | ||
new DataItem { Date = "June", Revenue = 253000 }, | ||
new DataItem { Date = "July", Revenue = 274000 }, | ||
new DataItem { Date = "August", Revenue = 284000 }, | ||
new DataItem { Date = "September", Revenue = 273000 }, | ||
new DataItem { Date = "October", Revenue = 282000 }, | ||
new DataItem { Date = "November", Revenue = 289000 }, | ||
new DataItem { Date = "December", Revenue = 294000 } | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@page "/chart-label-rotation" | ||
|
||
<RadzenText TextStyle="TextStyle.H2" TagName="TagName.H1" class="rz-pt-8"> | ||
Radzen Blazor Chart label rotation | ||
</RadzenText> | ||
<RadzenText Anchor="chart-label-rotation#auto-rotation" TextStyle="TextStyle.H5" TagName="TagName.H2" class="rz-pt-12"> | ||
Auto Rotation | ||
</RadzenText> | ||
<RadzenText TextStyle="TextStyle.Body1" class="rz-mb-8"> | ||
The Radzen Blazor Chart component can automatically rotate the labels of the category axis when they overlap. | ||
To enable that set the <strong>LabelAutoRotation</strong> property: <code>LabelAutoRotation="-45"</code>. | ||
</RadzenText> | ||
<RadzenText TextStyle="TextStyle.Body1" class="rz-mb-8"> | ||
Try changing the angle and the width of the chart to see the effect. | ||
</RadzenText> | ||
<RadzenExample ComponentName="Chart" Example="ChartLabelAutoRotation" DocumentationLink="https://blazor.radzen.com/docs/guides/components/chart.html"> | ||
<ChartLabelAutoRotation /> | ||
</RadzenExample> | ||
<RadzenText Anchor="chart-label-rotation#rotation" TextStyle="TextStyle.H5" TagName="TagName.H2" class="rz-pt-12"> | ||
Predefined Rotation | ||
</RadzenText> | ||
<RadzenText TextStyle="TextStyle.Body1" class="rz-mb-8"> | ||
To always rotate the labels of the category axis set the <strong>LabelRotation</strong> property: <code>LabelRotation="-45"</code>. | ||
</RadzenText> | ||
<RadzenText TextStyle="TextStyle.Body1" class="rz-mb-8"> | ||
Try changing the angle and the width of the chart to see the effect. | ||
</RadzenText> | ||
<RadzenExample ComponentName="Chart" Example="ChartLabelAutoRotation" DocumentationLink="https://blazor.radzen.com/docs/guides/components/chart.html"> | ||
<ChartLabelRotation /> | ||
</RadzenExample> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters