Background highlight for second series


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


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

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


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,

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
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 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? 


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