Hiding the first tick on the primary x-axis of the 2D bar chart


https://www.nevron.com/Forum/Topic6521.aspx
Print Topic | Close Window

By Andre Van Wyk - 12 Years Ago
Hi

A tick is visible where the x-axis touches the y-axis and I want it removed or hidden.
Please see the attached screenshot.

Thanks,
Andre

Edited: Looks like the attachment didn't make it. I am using the category grouping labels on the axis to create the ticks on the x-axis on both sides of the bars. Where this overlaps the y-axis, it is visible. I cannot determine where to set it's color and thickness; if I can do that it may be indistinguishable from the y-axis.
By Nevron Support - 12 Years Ago

Hi Andre,

Can you send the attachment to support@nevron.com for further investigation.

By Andre Van Wyk - 12 Years Ago
Here is the solution given to me by Nevron:

using System;
using System.Drawing;
using System.Windows.Forms;
using Nevron;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;

namespace MyNamespace
{
///
/// Sample class
///

public class MyClass
{
///
/// Main entry point
///

///
public static void RSMain(NRSChartCodeContext context)
{
NChart chart = context.Document.Charts[0];

NAxis axis = chart.Axis(StandardAxis.PrimaryX);
NOrdinalScaleConfigurator ordinalScale = axis.ScaleConfigurator as NOrdinalScaleConfigurator;

if (ordinalScale != null)
{
axis.UpdateScale();

int categoryCount = ordinalScale.Labels.Count;

double[] tickValues = new double[categoryCount];

for (int i = 0; i < categoryCount; i++)
{
tickValues[i] = i + 0.5;
}

NCustomRangeSampler rangeSampler = new NCustomRangeSampler(tickValues);

NScaleTickFactory tickFactory = new NScaleTickFactory(ScaleTickShape.Line,
new NLength(0),
new NSizeL(new NLength(1), new NLength(5, NGraphicsUnit.Point)),
new NConstValueProvider(new NColorFillStyle(Color.Black)),
new NConstValueProvider(new NStrokeStyle(1, Color.Black)),
HorzAlign.Left);

NScaleLevel scaleLevel = new NScaleLevel();
scaleLevel.Decorators.Add(new NSampledScaleDecorator(rangeSampler, tickFactory));

axis.Scale.Levels.Insert(0, scaleLevel);
axis.Scale.OriginLevel = axis.Scale.OriginLevel + 1;
}
}
}
}

This is working great :-)