Force Axis to refresh tick labels?

Sep 3, 2009 at 9:06 PM

We're using VerticalAxis and HorizontalAxis on our plot and have specified the .LabelProvider.SetCustomFormatter() to allow the tick formatting to be localized (I.e., use the correct '.' or ',' character as the decimal "point").  The formatter we use is itself aware of the culture issue:

    private static string TickFormatter(LabelTickInfo<double> info)
      return info.Tick.ToString(CultureInfo.CurrentCulture);

Setting this as the Custom Formatter: 


works except that on a change of language/culture, there's no way to force it to refresh the tick labels.  We cannot force the axes to redraw the ticks unless we change the formatter delegate passed to SetCustomFormatter(), by using a lambda that creates a new delegate whenever it is passed:

axis.LabelProvider.SetCustomFormatter(info => TickFormatter(info));

This is inelegant (and inefficient) to create the new delegate just so the side effect can be forced.  Having a Refresh() on the LabelProvider would simplify this.


Sep 8, 2009 at 9:40 AM


I've added a ForceUpdate method to all axes.

It should solve your problem.


By the way, why do you override tick formatting in this way? By default this is done by calling .ToString() method of each tick, which formats tick certainly in CultureInfo.CurrentCulture.

You only need to some how update axis, and now I'm giving you means to perform it.


Best regards,


Sep 8, 2009 at 5:51 PM

The example I used was simplified from the actual formatting being done.