Axis Label Colors Problem


Author
Message
Lou Laskey
Lou Laskey
Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)
Group: Forum Members
Posts: 24, Visits: 2

Hi All,

I have a NChartControl that has 3 NCharts.  The NCharts are configured as a horizontal bar graphs with multiple bar and line series.

(I attemped to insert a screen grab of the chart with no success so maybe the attachment worked)

The left axis (PrimaryX) is for data displayed as bars.  The top axis (SecondaryY) is for data displayed as a line and the bottom (PrimaryY) axis of course goes with the amplitude of the bars.

The image is from a test program with the two color selectors being used to select the color of the scale labels and title.

Seems simple enough but here is the problem:

If I change the color of the top color selector (which should affect only the top scale) all the scales change color except the title of the bottom scale.

I attached a NChartCommandBar to the chart control to see if I could control the colors properly with it but it also acts very strange.  I haven't totally established the pattern yet but it doesn't change the label and title colors correctly.  It appears the axes are connected in some fashion but not directly since not everything changes on an axis (labels and title color) at the same time.

Here is a snippet of code I use to change the the color of the labels and title of the SecondaryY axis.

      for (int iChart = 0; iChart < argChartControl.Charts.Count; iChart++)
      {
        NChart locChart = argChartControl.Charts[iChart];
        NLinearScaleConfigurator chartScale = (NLinearScaleConfigurator)locChart.Axis(StandardAxis.SecondaryY).ScaleConfigurator;
        NScaleLabelStyle itemLabelStyle = chartScale.LabelStyle;
        NTextStyle itemLabelTextStyle = itemLabelStyle.TextStyle;
        NColorFillStyle itemLabelFillStyle = new NColorFillStyle(argItemLabelColor);
        itemLabelTextStyle.FillStyle = itemLabelFillStyle;
        itemLabelStyle.TextStyle = itemLabelTextStyle;
        chartScale.LabelStyle = itemLabelStyle;
        chartScale.Title.TextStyle.FillStyle = itemLabelFillStyle;
        if (argRefresh) locChart.Refresh();
      }

Any help would be appreciated.

Thanks,

Lou


Attachments
ChartTest.jpg (75 views, 27.00 KB)
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hello Lou,

Please make sure that you are using different scale configurator instances for the different axes. Each axis must have its own NScaleConfigurator.

By the way, looks like it is not necessary to call locChart.Refresh() on each iteration.



Best Regards,
Nevron Support Team


Lou Laskey
Lou Laskey
Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)Junior Member (24 reputation)
Group: Forum Members
Posts: 24, Visits: 2
Thanks for the reply.

It was obvious that they were linked somehow but I was having trouble finding where.

Turns out I was reusing an NScaleLabel instance that had been initialized off the first axis I was working with.

Problem solved.

As far as the Refresh goes, I sometimes refresh each graph in a control and then the control. It seems to require that for some reason but not always.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search