我有一個數據系列List<Tuple<string,double>>
,我從中創建了一個XyDataSeries<double, double>
。我使用以下LabelFormatter
。SciChart Column Series LabelFormatting
public class SciChartCustomLabelFormatter : ILabelFormatter
{
private readonly string[] _xLabels;
public SciChartCustomLabelFormatter(string[] xLabels)
{
_xLabels = xLabels;
}
public void Init(IAxis parentAxis)
{
}
public void OnBeginAxisDraw()
{
}
public ITickLabelViewModel CreateDataContext(IComparable dataValue)
{
throw new NotImplementedException();
}
public ITickLabelViewModel UpdateDataContext(ITickLabelViewModel labelDataContext, IComparable dataValue)
{
throw new NotImplementedException();
}
public string FormatLabel(IComparable dataValue)
{
var index = (double)Convert.ChangeType(dataValue, typeof(double));
if (index >= 0 && index < _xLabels.Length)
return _xLabels[(int)index];
return index.ToString(CultureInfo.InvariantCulture);
}
public string FormatCursorLabel(IComparable dataValue)
{
var index = (double)Convert.ChangeType(dataValue, typeof(double));
if (index >= 0 && index < _xLabels.Length)
return _xLabels[(int)index];
return index.ToString(CultureInfo.InvariantCulture);
}
}
我想創建一個FastColumnRenderableSeries
<sciChart:FastColumnRenderableSeries
x:Name="columnSeries" DataPointWidth="1"
SeriesColor="#A99A8A" Opacity="0.5"
XAxisId="BottomAxisId"
YAxisId="LeftAxisId"
DataSeries="{Binding Series}">
</sciChart:FastColumnRenderableSeries>
與字符串被用作標籤列系列。
目前,我可以用YAxis顯示系列,清晰顯示數值。 但是,如何使用標籤格式化程序來顯示XAxis字符串?我不知道我應該怎麼做的方法:
public ITickLabelViewModel CreateDataContext(IComparable dataValue)
和
public ITickLabelViewModel UpdateDataContext(ITickLabelViewModel labelDataContext, IComparable dataValue)
我想在這裏創建一個帕累託圖。