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
;
// get the first chart in the document
NChart chart = context.Document.Charts[0];
if
(chart.Series.Count == 0)
return
;
// configure Y axis scale
NAxis yAxis = chart.Axis(StandardAxis.PrimaryY);
NLinearScaleConfigurator yLinearScale = yAxis.ScaleConfigurator
as
NLinearScaleConfigurator;
// set Y standard ticks / grid lines to custom step 5
yLinearScale.MajorTickMode = MajorTickMode.CustomStep;
yLinearScale.CustomStep = 5;
// update the Y scale definition
yAxis.UpdateScale();
NWallDecoratorCollection yWallDecorators = yAxis.Scale.WallDecorators;
NCustomWallDecorator yWallDecorator =
new
NCustomWallDecorator();
for
(
int
i = 0; i < 100000; i += 15)
{
NGridLine yGridLine =
new
NGridLine(i,
new
NStrokeStyle(Color.Red),
new
ChartWallType[] { ChartWallType.Back },
false
);
yWallDecorator.WallDecorations.Add(yGridLine);
}
yWallDecorators.Add(yWallDecorator);
// configure X axis scale
NAxis xAxis = chart.Axis(StandardAxis.PrimaryX);
NLinearScaleConfigurator xLinearScale = xAxis.ScaleConfigurator
as
NLinearScaleConfigurator;
// set X standard ticks / grid lines to custom step 10000
//xLinearScale.MajorTickMode = MajorTickMode.CustomStep;
//xLinearScale.CustomStep = 10000;
// update the X scale definition
xAxis.UpdateScale();
NWallDecoratorCollection xWallDecorators = xAxis.Scale.WallDecorators;
NCustomWallDecorator xWallDecorator =
new
NCustomWallDecorator();
for
(
int
i = 0; i < 100000; i += 1500)
{
NGridLine xGridLine =
new
NGridLine(i,
new
NStrokeStyle(Color.Blue),
new
ChartWallType[] { ChartWallType.Back },
false
);
xWallDecorator.WallDecorations.Add(xGridLine);
}
xWallDecorators.Add(xWallDecorator);
}
}
}
Imports
System
Imports
System.Drawing
Imports
Nevron.GraphicsCore
Imports
Nevron.Chart
Imports
Nevron.ReportingServices
Namespace
MyNamespace
''' <summary>
''' Sample class
''' </summary>
Public
Class
[
MyClass
]
''' <summary>
''' Main entry point
''' </summary>
''' <param name="context"></param>
Public
Shared
Sub
RSMain(context
As
NRSChartCodeContext)
If
context.Document.Charts.Count = 0
Then
Return
End
If
' get the first chart in the document
Dim
chart
As
NChart = context.Document.Charts(0)
If
chart.Series.Count = 0
Then
Return
End
If
' configure Y axis scale
Dim
yAxis
As
NAxis = chart.Axis(StandardAxis.PrimaryY)
Dim
yLinearScale
As
NLinearScaleConfigurator = TryCast(yAxis.ScaleConfigurator, NLinearScaleConfigurator)
' set Y standard ticks / grid lines to custom step 5
yLinearScale.MajorTickMode = MajorTickMode.CustomStep
yLinearScale.CustomStep = 5
' update the Y scale definition
yAxis.UpdateScale()
Dim
yWallDecorators
As
NWallDecoratorCollection = yAxis.Scale.WallDecorators
Dim
yWallDecorator
As
New
NCustomWallDecorator()
For
i
As
Integer
= 0
To
99999
Step
15
Dim
yGridLine
As
New
NGridLine(i,
New
NStrokeStyle(Color.Red),
New
ChartWallType() {ChartWallType.Back},
False
)
yWallDecorator.WallDecorations.Add(yGridLine)
Next
yWallDecorators.Add(yWallDecorator)
' configure X axis scale
Dim
xAxis
As
NAxis = chart.Axis(StandardAxis.PrimaryX)
Dim
xLinearScale
As
NLinearScaleConfigurator = TryCast(xAxis.ScaleConfigurator, NLinearScaleConfigurator)
' set X standard ticks / grid lines to custom step 10000
'xLinearScale.MajorTickMode = MajorTickMode.CustomStep;
'xLinearScale.CustomStep = 10000;
' update the X scale definition
xAxis.UpdateScale()
Dim
xWallDecorators
As
NWallDecoratorCollection = xAxis.Scale.WallDecorators
Dim
xWallDecorator
As
New
NCustomWallDecorator()
For
i
As
Integer
= 0
To
99999
Step
1500
Dim
xGridLine
As
New
NGridLine(i,
New
NStrokeStyle(Color.Blue),
New
ChartWallType() {ChartWallType.Back},
False
)
xWallDecorator.WallDecorations.Add(xGridLine)
Next
xWallDecorators.Add(xWallDecorator)
End
Sub
End
Class
End
Namespace