Range Chart or Coloring Stock Chart


Author
Message
Jerry Jacob
Jerry Jacob
Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)
Group: Forum Members
Posts: 15, Visits: 78
Initially I made a range chart but I could not find out how to change the width of the line to be the size I wanted, however the coloring worked.

Next I tried to instead use a stock chart to do the same thing, and while the width is great, I can't seem to figure out how to change the color of each bar.  I have the following and it doesn't seem to work.

Color lineColor = Color.FromArgb(convertedItems[0],convertedItems[1],convertedItems[2]);
range.FillStyles[i] = new NColorFillStyle(lineColor);

Any suggestions?
Reply
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
Hi Jerry,
We just tested the range series with the following code:

private void Form1_Load(object sender, EventArgs e)
{
// setup chart
NChart chart = nChartControl1.Charts[0];
chart.Enable3D = false;

// setup shape series
NRangeSeries rangeSeries = (NRangeSeries)chart.Series.Add(SeriesType.Range);
rangeSeries.FillStyle = new NColorFillStyle(Color.Red);
rangeSeries.BorderStyle.Color = Color.DarkRed;
rangeSeries.Legend.Mode = SeriesLegendMode.None;
rangeSeries.DataLabelStyle.Visible = false;
rangeSeries.UseXValues = true;
rangeSeries.UseZValues = true;

    // add data
AddDataPoint(rangeSeries, 1, 5, 11, 17, 5, 9);
AddDataPoint(rangeSeries, 4, 7, 15, 19, 16, 19);
AddDataPoint(rangeSeries, 5, 15, 6, 11, 12, 18);
AddDataPoint(rangeSeries, 9, 14, 2, 5, 3, 5);
AddDataPoint(rangeSeries, 15, 19, 2, 5, 3, 5);

rangeSeries.FillStyles[0] = new NColorFillStyle(Color.Red);
rangeSeries.FillStyles[1] = new NColorFillStyle(Color.Green);
rangeSeries.FillStyles[2] = new NColorFillStyle(Color.Blue);

rangeSeries.BorderStyles[0] = new NStrokeStyle(2, Color.Yellow);
rangeSeries.BorderStyles[1] = new NStrokeStyle(2, Color.Cyan);
rangeSeries.BorderStyles[2] = new NStrokeStyle(2, Color.Magenta);
}

private void AddDataPoint(NRangeSeries series, double x1, double x2, double y1, double y2, double z1, double z2)
{
series.XValues.Add(x1);
series.X2Values.Add(x2);
series.Values.Add(y1);
series.Y2Values.Add(y2);
series.ZValues.Add(z1);
series.Z2Values.Add(z2);
}

and it was working properly - the filling and stroke for the first three ranges were modified as expected. Hope this helps - can you post the code that you use to automate the control for review?

Best Regards,
Nevron Support Team


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