Set the origin (cross at) property for a bar chart in SSRS

Applies to: Nevron Chart for Reporting Services (SSRS 2005 and 2008)

How to set the origin (cross at) property for a bar chart in SSRS?

You can set the bar origin property so the bars will display either upward or downward, depending if the values are above or under the custom origin.



Use the following code in the Code tab of the Chart designer to modify the origin:

[C#]
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]; 
            NBarSeries bar = chart.Series[0] as NBarSeries; 
                
            if (bar != null
            
                bar.OriginMode = SeriesOriginMode.CustomOrigin; 
                bar.Origin = 20; 
            
        
    
}

Article ID: 102, Created On: 10/27/2010, Modified: 12/1/2010