Profile Picture

Custom code error?

Posted By Clare Moore 13 Years Ago
Author
Message
Clare Moore
Posted 13 Years Ago
View Quick Profile
Junior Member

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
Last Active: 11 Years Ago
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
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Today @ 1:54 AM
Posts: 3,054, Visits: 4,009

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
Posted 13 Years Ago
View Quick Profile
Junior Member

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
Last Active: 11 Years Ago
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
Posted 13 Years Ago
View Quick Profile
Junior Member

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
Last Active: 11 Years Ago
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
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Today @ 1:54 AM
Posts: 3,054, Visits: 4,009

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





Similar Topics


Reading This Topic