我正在使用 Syncfusion Blazor 条形图。我的条形图与线条结合的要求低于要求。有没有办法做到这一点?有什么线索吗?
问问题
68 次
1 回答
1
我们可以使用图表组件中的列系列和线系列来满足您的要求(基于屏幕截图)。我们还准备了一个样本供您参考。
示例链接: https ://www.syncfusion.com/downloads/support/directtrac/general/ze/ColumnLineSeries1543449603.zip
代码片段:
<SfChart Title="Hyaat Place Cedar Park 17-4-006" >
<ChartEvents OnAxisLabelRender="AxisLabelRender"></ChartEvents>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" Interval="1">
<ChartAxisLabelStyle Color="transparent"></ChartAxisLabelStyle>
<ChartAxisLineStyle Width="0"></ChartAxisLineStyle>
<ChartAxisMajorTickLines Width="0"></ChartAxisMajorTickLines>
<ChartAxisMajorGridLines Width="0"></ChartAxisMajorGridLines>
</ChartPrimaryXAxis>
<ChartPrimaryYAxis >
<ChartAxisLineStyle Width="0"></ChartAxisLineStyle>
<ChartAxisMajorTickLines Width="0"></ChartAxisMajorTickLines>
</ChartPrimaryYAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@ChartPoints" Fill="#3864c6" XName="Country" YName="GoldMedal" Type="ChartSeriesType.Column">
</ChartSeries>
<ChartSeries DataSource="@ChartPoints" Fill="#85dba0" XName="Country" YName="SilverMedal" Type="ChartSeriesType.Column">
</ChartSeries>
<ChartSeries DataSource="@ChartPoints" Fill="#837fca" Width="3" XName="Country" YName="BronzeMedal" Type="ChartSeriesType.Line">
<ChartMarker Visible="true" Width="5" Height="5" Fill="#837fca">
</ChartMarker>
</ChartSeries>
</ChartSeriesCollection>
<ChartTooltipSettings Enable="true"></ChartTooltipSettings>
</SfChart>
// add your additional code here
public void AxisLabelRender(AxisLabelRenderEventArgs args)
{
if (args.Axis.Name == "PrimaryYAxis")
{
args.Text = "$"+ Convert.ToDouble(args.Text).ToString("N0");
}
}
于 2021-05-26T09:57:06.143 回答