我有工作栏系列 .
我有大约50个多列系列要显示,当有更多数量的条形时,它会缩小条形宽度并调整到图表宽度 .
因此,我想仅向类别轴X添加滚动并水平滚动并固定条的宽度,如果X轴的更多数量应该水平拉伸 .
这是屏幕截图:
在屏幕截图中,您可以看到第3个系列正在切割,而不是滚动 .
这是我尝试过的:
<charting:Chart Name="barChart"
Style="{StaticResource PhoneChartStyle}"
Template="{StaticResource BarChartTemplate}">
<charting:Chart.Axes>
<charting:LinearAxis ShowGridLines="True" Title="Scores" Orientation="Y" Minimum="0" Maximum="50" Interval="10"/>
<charting:CategoryAxis HorizontalContentAlignment="Stretch"
HorizontalAlignment="Stretch"
Title="Fruits"
Width="1000"
Orientation="X"
ScrollViewer.HorizontalScrollBarVisibility="Visible">
</charting:CategoryAxis>
</charting:Chart.Axes>
<charting:Chart.Series>
<charting:ColumnSeries
Title="Apple"
IndependentValueBinding="{Binding Key}"
DependentValueBinding="{Binding Value}"
AnimationSequence="Simultaneous">
</charting:ColumnSeries>
<charting:ColumnSeries
Title="Oranges"
IndependentValueBinding="{Binding Key}"
DependentValueBinding="{Binding Value}"
AnimationSequence="Simultaneous">
</charting:ColumnSeries>
<charting:ColumnSeries
Title="Guava"
IndependentValueBinding="{Binding Key}"
DependentValueBinding="{Binding Value}"
AnimationSequence="Simultaneous">
</charting:ColumnSeries>
</charting:Chart.Series>
</charting:Chart>*
1 回答
我有同样的问题,这个技巧解决了这个问题 . 愿这也对你有所帮助 .
//设置barChart的ItemSource后面的代码//我假设你的itemSource应该是List collection = new List(); //barChart.ItemSource = collection;