-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Features Suggestion
Feature description: In #1100 , a custom formatter can be used to format the tick lables, but crosshair doesn't support it, which leads to inconsistencies in the label display. It might be possible to add CustomLabelFormatX and CustomLabelFormatY to solve this problem. I can make a pull request if needed.
Code example:
plt.AddSignal(ScottPlot.DataGen.Sin(51));
plt.AddSignal(ScottPlot.DataGen.Cos(51));
var crosshair = plt.AddCrosshair(10, 0);
// create a custom formatter as a static class
static string customLabelFormatter(double position)
{
if (position == 0)
return "zero";
else if (position > 0)
return $"+{position:F2}";
else
return $"({Math.Abs(position):F2})";
}
// use the custom formatter for horizontal and vertical tick labels
plt.XAxis.TickLabelFormat(customLabelFormatter);
plt.YAxis.TickLabelFormat(customLabelFormatter);
// use the custom formmater for crosshair labels
crosshair.CustomLabelFormatX(customLabelFormatter);
crosshair.CustomLabelFormatY(customLabelFormatter);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels