Profile Picture

Axis Label Colors Problem

Posted By Lou Laskey 13 Years Ago
Author
Message
Lou Laskey
Posted 13 Years Ago
View Quick Profile
Junior Member

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
Last Active: 9 Years Ago
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 (61 views, 27.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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
Posted 13 Years Ago
View Quick Profile
Junior Member

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
Last Active: 9 Years Ago
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.




Similar Topics


Reading This Topic