2

I'm using the DevExpress xtraChart to display some data. In the CustomDrawSeries event, I'm checking the series name and changing SeriesTemplate.Label.PointOptions.ValueNumericOptions.Format. It works... partially.

The idea is to change ValueNumericOptions.Format from NumericFormat.FixedPoint to NumericFormat.Percent and vice versa based on the name. The problem is the change is not displayed immediately. In order to see the change, the user must select another cell and then the change is visible immediately.

How can I force a refresh to the series and see the changes immediately without needing to select another cell?

Update - After the change is made via code, I inspected Format and it is being set correctly. This confirms, in my mind anyway, this is a refresh issue.

DenaliHardtail
  • 27,362
  • 56
  • 154
  • 233

2 Answers2

1

I do not know what the real cause of the problem, but your approach seems to be not quite optimal. You modify the global settings (template) while your goal is just to change settings for a certain series.

What you want to achieve can be done during the ChartControl initialization, without having to handle events. The following code can be used to apply a percent format to a certain series:

DevExpress.XtraChartsPointOptions pointOptions = new DevExpress.XtraChartsPointOptions();
pointOptions.ValueNumericOptions.Format = DevExpress.XtraCharts.NumericFormat.Percent;
DevExpress.XtraCharts.SideBySideBarSeriesLabel label = new DeveExpress.XtraCharts.SideBySideBarSeriesLabel();
label.PointOptions = pointOptions;
DevExpressXtraChartsSeries series = xtraChart1.Series["Series Name"];
series.Label = label;
series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
Uranus
  • 1,690
  • 1
  • 12
  • 22
0

By the sounds of it you are registering to the Refresh event of the view controller which will change the format of the chart on refresh, assign your code also in the OnViewControlsCreated event to initialize your code upon first creating the view.

Shwabster
  • 479
  • 1
  • 10
  • 27