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.


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 Clare,

Can you post the complete code you use in the report? The code excerpt above is not problematic by itself.



Best Regards,
Nevron Support Team


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));

}

}

}


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

Ok, i added a test for empty values and now i dont get an error, however i only seem to have values in one of my begin and end values.

I changed the code so that a stripe was added for each valid start and end, and i ONLY get one stripe for the very first item??? (which incidentally was in beginvalues[3] and endvalues[3]

I'm really confused about why this might be so??

How do i access the rest of my values and why is it appearing that there is only one?  Could this be caused by grouping?


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 Clare,

Can we schedule a web meeting? - it looks like the configuration / data does not match the standard example shipped with the control, which makes the results "unpredictable". To schedule a web meeting you can send an e-mail at "sales at nevron dot com".



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