Profile Picture

NMarkerstyles question

Posted By Henning Olsson 15 Years Ago
Author
Message
Henning Olsson
Posted 15 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: Forum Members
Last Active: 15 Years Ago
Posts: 1, Visits: 1
I'm trying to change the color of the lines and points (markers) in a 2D line chart depending on a third variable.

X value = variable 1
Y value = variable 2
Color value = variable 3

I managed to do it for the lines using:
line(g).BorderStyles(i - 1) = New NStrokeStyle(2, Color.FromArgb(RGB(0), RGB(1), RGB(2)))

But I can't get the equivalent to work for MarkerStyles.

I tried this, but it doesn't work:
line(g).MarkerStyles(i - 1) = New NColorFillStyle(Color.FromArgb(RGB(0), RGB(1), RGB(2)))

All help will be greatly appreciated!



bob milanov
Posted 15 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Henning,

You have to assign instances of the NMarkerStyle object - the following code shows how to do it individually per data point using the default series marker:

NChart chart = nChartControl1.Charts[0];

chart.BoundsMode = BoundsMode.Stretch;

 

// add some sample data

NLineSeries line = new NLineSeries();

Random rand = new Random();

line.DataLabelStyle.Visible = false;

 

for (int i = 0; i < 10; i++)

{

    line.Values.Add(rand.Next(100));

    NMarkerStyle markerStyle = (NMarkerStyle)line.MarkerStyle.Clone();

    markerStyle.FillStyle = new NColorFillStyle(Color.Red);

    markerStyle.Visible = true;

    line.MarkerStyles[i] = markerStyle;

}

 

chart.Series.Add(line);

nChartControl1.Refresh();

Hope this helps - let me know if you meet any problems.

Best regards,
Bob





Similar Topics


Reading This Topic