List<Tuple<string,double>>
を作成するデータ シリーズがありますXyDataSeries<double, double>
。私は以下を使用しますLabelFormatter
。
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)
ここでパレート図を作成しようとしています。