How do I set the ChartValueAxisLabelsRotation Angle to auto? It has the same description as the ChartCategoryAxisLabelsRotation Angle, but instead of taking "@object" the ValueAxis takes "Double?"?
Description for both ChartCategoryAxisLabelsRotation and ChartValueAxisLabelsRotation Angle:
The rotation angle of the labels. By default the labels are not rotated. Can be set to "auto" if the axis is horizontal in which case the labels will be rotated only if the slot size is not sufficient for the entire labels.
Error:
Cannot convert string to double?
Code:
<TelerikChart>
<ChartSeriesItems>
<ChartSeries Type="ChartSeriesType.Column" Name="Product 1" Data="@series1Data">
</ChartSeries>
<ChartSeries Type="ChartSeriesType.Column" Name="Product 2" Data="@series2Data">
</ChartSeries>
</ChartSeriesItems>
<ChartValueAxes>
<ChartValueAxis>
<ChartValueAxisLabels>
<ChartValueAxisLabelsRotation Angle="@AutoLabelsRotation" />
</ChartValueAxisLabels>
</ChartValueAxis>
</ChartValueAxes>
<ChartCategoryAxes AxisCrossingValue="crossingPoints">
<ChartCategoryAxis Categories="@xAxisItems">
<ChartCategoryAxisLabels>
<ChartCategoryAxisLabelsRotation Angle="@AutoLabelsRotation" />
</ChartCategoryAxisLabels>
</ChartCategoryAxis>
</ChartCategoryAxes>
<ChartTitle Text="Quarterly revenue per product"></ChartTitle>
</TelerikChart>
@code {
string AutoLabelsRotation = "auto";
public List<object> series1Data = new List<object>() { 10, 2, 5, 6, 8 };
public List<object> series2Data = new List<object>() { 5, 8, 2, 7, 6 };
public string[] xAxisItems = new string[5];
protected override void OnInitialized()
{
for (int i = 0; i < 5; i++)
{
xAxisItems[i] = $"looooong label {i + 1}";
}
base.OnInitialized();
}
}
Regards,
Nikolas