Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1272

Summary: Force Label at beginning of Axis irrespective of Increment limitations
Product: .NET TeeChart Reporter: marc meumann <marc>
Component: AxesAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: enhancement    
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description marc meumann 2015-08-17 06:28:08 EDT
The OnAxis property enables/disables first/last Axis label for regularly incremented labels. This is something slightly different....

To oblige the placement of a first label, to coincide with the minimum axis value, irrespective of it's validity in relation to the Axis' own increment settings.

Effect can be seen with this workaround code:

=========================
using Steema.TeeChart;
using System.Reflection;

private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
    //set x position for new label
    int x = tChart1.Axes.Bottom.CalcPosValue(tChart1.Axes.Bottom.Minimum);

    //tChart1.Axes.Bottom.Labels.position (here the Label y coordinate) is protected so need alternative technique for y...
    AxisLabels tmpLabels = new AxisLabels(tChart1.Axes.Bottom);
    FieldInfo privateField = tmpLabels.GetType().GetField("position", BindingFlags.NonPublic | BindingFlags.Instance);
    int y = (int)privateField.GetValue(tChart1.Axes.Bottom.Labels);

    string label = tChart1.Axes.Bottom.Minimum.ToString("#");

    //output text
    g.TextOut(x - ((int)Math.Round(g.TextWidth(label) / 2)), y, label);
}
=========================