I'm trying to access a scaling factor in a viewModel through my CustomNumericLabelProvider.
I'm not quite sure what the best approach is, but I figured I might be able to access it through the parent axis if I used the Init(IAxis parentAxis) method which was shown in the LabelProvider documentation. I've given that a try, but now I'm getting an error telling me that "There is no suitable method for override".
If I comment out the Init() method, CustomNumericLabelProvider works great (with a hard-coded scaling factor).
Any idea why I'm receiving this error message? Or what another good approach would be to gain access to the scaling factor in my viewModel?
Note: I've also tried passing the viewModel into a custom constructor for the label provider (I was able to do something like this with viewportManager), however that didn't seem to work.
Here's the code (With the custom constructor, although I get the same error message without it)
public class CustomNumericLabelProvider : SciChart.Charting.Visuals.Axes.LabelProviders.NumericLabelProvider
{
// Optional: called when the label provider is attached to the axis
public override void Init(IAxis parentAxis) {
// here you can keep a reference to the axis. We assume there is a 1:1 relation
// between Axis and LabelProviders
base.Init(parentAxis);
}
/// <summary>
/// Formats a label for the axis from the specified data-value passed in
/// </summary>
/// <param name="dataValue">The data-value to format</param>
/// <returns>
/// The formatted label string
/// </returns>
public override string FormatLabel(IComparable dataValue)
{
// Note: Implement as you wish, converting Data-Value to string
var converted = (double)dataValue * .001 //TODO: Use scaling factor from viewModel
return converted.ToString();
// NOTES:
// dataValue is always a double.
// For a NumericAxis this is the double-representation of the data
}
}