Custom code error?


Author
Message
Clare Moore
Clare Moore
Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)
Group: Forum Members
Posts: 22, Visits: 1

I am having trouble with some custom code, I want to get the range of my data and add a line midway

I tested out some code that works ok for a floatbar in the winforms charting object, and tried to use it in the reporting chart tool custom code.

double test = (double)floatBar.Values[0];

As soon as i put this code into my report it no longer runs as says there is an error, as soon as i remove  it it runs again.  Same for BeginValues, EndValues etc.

Am i doing something wrong?  I have two level grouping on my report but i'm not sure if that makes a difference.


Reply
Clare Moore
Clare Moore
Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)
Group: Forum Members
Posts: 22, Visits: 1

This is my code, if i remove these four lines:

double start = (double)floatBar.BeginValues[floatBar.BeginValues.Count - 1];

double end = (double)floatBar.EndValues[floatBar.BeginValues.Count - 1];

NAxisStripe s1 = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(start, end);

s1.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue));

The code runs fine and the purple constline gets printed.  What I'm actually trying to do is highlight specific values in my series.

 

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)

{

if (context.Document.Charts.Count == 0)

return;

NChart chart = context.Document.Charts[0];

//Create shift markers

int shiftCount = context.GetInt32Parameter("shiftCount");

for (int i = 1; i < shiftCount; i++)

{

NFloatBarSeries floatBar = chart.Series[0] as NFloatBarSeries;

NAxis yAxis = chart.Axis((int)StandardAxis.PrimaryY);

//NAxisConstLine cl1 = chart.Axis(StandardAxis.PrimaryY).ConstLines.Add();

NAxisConstLine cl1 = yAxis.ConstLines.Add();

cl1.StrokeStyle.Color = Color.Purple;

cl1.StrokeStyle.Width = new NLength(1.5f);

cl1.FillStyle = new NColorFillStyle(new NArgbColor(125, Color.Purple));

cl1.Value = 40569.3;

double start = (double)floatBar.BeginValues[floatBar.BeginValues.Count - 1];

double end = (double)floatBar.EndValues[floatBar.BeginValues.Count - 1];

NAxisStripe s1 = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(start, end);

s1.FillStyle = new NColorFillStyle(Color.FromArgb(125, Color.SteelBlue));

}

}

}


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