问题
I have plotted different series in basic column chart of live charts. but they are too close too each other. can i give some margin between them ? Also it doesn't show title of each series ?
for (int i=0; i< _saleInvoiceList.Count;i++)
{
_seriesCollection.Add( new ColumnSeries
{
Title = _saleInvoiceList[i].SOType,
DataLabels = true,
Foreground = new SolidColorBrush(Color.FromRgb(254,24,24)),
Values = new ChartValues<int>{_saleInvoiceList[i].Total},
//Fill = PickBrush(),
Margin = new Thickness(30,0,0,0)
});
DailySalesBarChart.LegendLocation = LegendLocation.Bottom;
DailySalesBarChart.Series = _seriesCollection;
回答1:
It’s showing the series title in the legend. If you want a label for each column, AFAIK you need to use a single series, cf. my other answer.
You can set the property ColumnPadding
on your series to create some space between columns.
For all ColumnSeries
in the XAML, probably the best place:
<Style TargetType="lvc:ColumnSeries">
<Setter Property="ColumnPadding" Value="16"/>
</Style>
or for individual series:
_seriesCollection.Add(new ColumnSeries
{
//your other settings
, ColumnPadding = 16
});
If you only have one series, this will put 16 pixels between all columns. If you have multiple series, it will put 16 pixels between the series and 32 (twice the padding) between the data points (in your example you only have one point per series).
来源:https://stackoverflow.com/questions/55982406/margin-between-different-series-ploted-in-live-charts-wpf