Profile Picture

Custom code to add stripes to a floating bar chart

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 trying to add some stripes to my floating bar chart using custom code.

NAxisStripe s1 = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3);

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

s1.SetShowAtWall(ChartWallType.Back, true);

 

This doesnt show anything, though if i change the code to Primary X, it does show a horizontal line, I am not sure why I cant get a vertical line to show up.

My other question is, can I access my dataset from the embedded code?  I actually want to highlight sections of activities based on the person who performed the activity, but i am unsure how to go about this or even if this is possible?

 



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)Supreme Being (4,329 reputation)

Group: Forum Members
Last Active: Last Year
Posts: 3,039, Visits: 3,746

Hi Clare,

Most likely your axis scales date / time values - if this is the case 2 and 3 are somewhere in the begging of last century as 0 is 1899 in OA date format. Just tested with the following code snippet inside the float bar example report:

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];
   
NAxisStripe s1 = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(new DateTime(2009, 3, 1).ToOADate(), new DateTime(2009, 4, 1).ToOADate());

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

s1.SetShowAtWall(ChartWallType.Back, true);


  }
 }
}

and it was working OK.



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

Thanks very much I realised shortly after posting that it would probable be that the values i was using werent valid ones!

Thanks again



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 added a test to check for empty values and my code no longer errors, however i put in some test code to add in a stripe for each start and end value.

I only end up with one stripe added to that chart, for the very first set of values.

It seems that only one BeginValue and EndValue is populated.

Could this be caused by grouping? how do i access my other values??





Similar Topics


Reading This Topic