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?
Replies
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
The code I have is as follows

using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;
using System.Text.RegularExpressions;

namespace MyNamespace
{
  public class MyClass
  {
    public static void RSMain(NRSChartCodeContext context)
    {
      if (context.document.Charts.Count == 0)
        return;
      
      NChart chart = context.document.Charts[0] as NChart;
           
      if (chart == null)
        return;
      NRangeSeries range = chart.Series[2] as NRangeSeries;
      //NStockSeries range = chart.Series[2] as NStockSeries;
    
      int dpCount = range.Values.Count;
      int backColorOffset = 0;

      for (int i = 0; i < dpCount; i++)
      {
      string strColors = (string)range.Labels[backColorOffset+i];
      if (strColors == "") {
      strColors = "0,0,0";
      }
      char[] delimiterChars = {','};
      string[] intColors = strColors.Split(delimiterChars);
      int[] convertedItems = Array.ConvertAll<string, int>(intColors, int.Parse);
      
       Color lineColor = Color.FromArgb(convertedItems[0],convertedItems[1],convertedItems[2]);
       int lineWidth = 50;

       range.FillStyles[i] = new NColorFillStyle(lineColor);
       range.BorderStyles[i] = new NStrokeStyle(lineWidth, lineColor);
      }
      // clean up the chart
      for (int i = range.Values.Count - 1; i >= dpCount; i--)
      {
        range.RemoveDataPointAt(i);
      }
    }
  }
}

But what I am saying is not that it doesn't run, but that the width after passing 2 doesnt change. If i change it to 1 and then to 2 i see a difference, but 2 to 3 or 2 to 10 or 2 to 50 shows no change in size.  

Using a stock chart I was able to get better widths, but the problem was I couldn't seem to change the colors the same way I am changing them now.
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,
What is the version of the control you're currently using - we just tested with following code in SSRS:

using System;
using System.Drawing;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;

namespace MyNamespace
{
 /// <summary>
 /// Sample class
 /// </summary>
 public class MyClass
 {
  /// <summary>
  /// Main entry point
  /// </summary>
  /// <param name="context"></param>
  public static void RSMain(NRSChartCodeContext context)
  {
   NChart chart = context.document.Charts[0];
   
   NRangeSeries rangeSeries = (NRangeSeries)chart.Series[0];
   
   for (int i = 0; i < rangeSeries.Values.Count; i++)
   {
    rangeSeries.BorderStyles[i] = new NStrokeStyle(5, Color.Red);
   }
  }
 }
}
And the borders looked OK. Can you check what happens with similar code in your project?




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