Profile Picture

Background highlight for second series

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 have a float bar chart, with two series

The series both have the same timeline, except one series is a bunch of activities and the other is the user who performed the activities

Currently the activities show as floating bars which is what i want.  Now I want to add striplines to the back of the chart to highlight which user was operating at which times.  Only one user will be on at a time.

Is there a way to somehow loop through my series data and get these values for highlighting the background? 



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,

Sure - you can loop over the float bar begin / end values:

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];
   
   NFloatBarSeries floatBar = chart.Series[0] as NFloatBarSeries;
   if (floatBar == null)
    return;
    
   for (int i = 0; i < floatBar.Values.Count; i++)
   {
    double start = (double)floatBar.BeginValues[i];
    double end = (double)floatBar.EndValues[i];

// do something with start/end values

   }
  }
 }
}



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

Thats what I was afraid of I was using code similar to yours.  I even changed my code to yours to see if i'd done something silly.

As soon as i put this in my report

 

for (int j = 0; j < floatBar.Values.Count; j++)

{

double start = (double)floatBar.BeginValues[j];

double end = (double)floatBar.EndValues[j];

}

 

i get an error: NChart Rendering Failed, Exception has been thrown by the target of an invocation

I cannot for the life of me figure out why this code wont work as it works fine in the winforms chart control



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 should add that i have two groups in my chart, though i'm not sure that this make a difference.  There ends up being 11 rows on my chart, made up of hundreds of datapoints because of the grouping.

This then seems to make it so that there are only 11 values in the floatBar.Values collection rather than the few hundred i expected....

Either way converting to a double definitely fails so i'm a bit stuck





Similar Topics


Reading This Topic