Axis Breaks and corrupt axis labels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Philipp P.
Newbie
Newbie
Posts: 3
Joined: Thu Dec 16, 2010 12:00 am

Axis Breaks and corrupt axis labels

Post by Philipp P. » Mon Jul 16, 2012 1:50 pm

Hello,

I am using the AxisBreak tool to mask out certain areas of my chart on the x-axis using multiple axis breaks, each with GapSize = 30. In most cases the axis breaks mess up my x-axis labels and it seems that multiple labels get overdrawn then (see image attachment)... Is there any way to avoid this?

Thanks in advance
Philipp
Attachments
overlapping labels.png
overlapping labels.png (91.62 KiB) Viewed 4474 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Axis Breaks and corrupt axis labels

Post by Narcís » Mon Jul 16, 2012 1:57 pm

Hi Philipp,

Can you please attach a simple example project we can run "as-is" to reproduce the problem here? A general option could be using custom axis labels as in the All Features\Welcome !\Axes\Labels\Custom labels example at the features demo available at TeeChart's program group.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Philipp P.
Newbie
Newbie
Posts: 3
Joined: Thu Dec 16, 2010 12:00 am

Re: Axis Breaks and corrupt axis labels

Post by Philipp P. » Wed Jul 18, 2012 12:05 pm

Hi Narcís,

The problem occurs with different gapsizes and x-axis ranges... I could reproduce the problem with the following small sample application:

Code: Select all


[MainForm.Designer.cs]

namespace GuiTestbench
{
  partial class MainForm
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.tChart1 = new Steema.TeeChart.TChart();
      this.fastLine1 = new Steema.TeeChart.Styles.FastLine();
      this.axisBreaksTool = new Steema.TeeChart.Tools.AxisBreaksTool();
      this.SuspendLayout();
      // 
      // tChart1
      // 
      // 
      // 
      // 
      // 
      // 
      // 
      this.tChart1.Axes.Depth.LabelsAsSeriesTitles = true;
      // 
      // 
      // 
      this.tChart1.Axes.DepthTop.LabelsAsSeriesTitles = true;
      this.tChart1.Dock = System.Windows.Forms.DockStyle.Fill;
      this.tChart1.Location = new System.Drawing.Point(0, 0);
      this.tChart1.Name = "tChart1";
      this.tChart1.Series.Add(this.fastLine1);
      this.tChart1.Size = new System.Drawing.Size(886, 465);
      this.tChart1.TabIndex = 0;
      this.tChart1.Tools.Add(this.axisBreaksTool);
      // 
      // fastLine1
      // 
      this.fastLine1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
      this.fastLine1.ColorEach = false;
      // 
      // 
      // 
      this.fastLine1.LinePen.Color = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(102)))), ((int)(((byte)(163)))));
      this.fastLine1.Title = "fastLine1";
      this.fastLine1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.Ignore;
      // 
      // 
      // 
      this.fastLine1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.Ascending;
      // 
      // axisBreaksTool
      // 
      this.axisBreaksTool.Axis = this.tChart1.Axes.Bottom;
      this.axisBreaksTool.GapSize = 5;
      this.axisBreaksTool.ScaleAdjustment = 1E-07D;
      // 
      // MainForm
      // 
      this.ClientSize = new System.Drawing.Size(886, 465);
      this.Controls.Add(this.tChart1);
      this.Name = "MainForm";
      this.Load += new System.EventHandler(this.MainForm_Load);
      this.ResumeLayout(false);

    }

    #endregion

    private Steema.TeeChart.TChart tChart1;
    private Steema.TeeChart.Styles.FastLine fastLine1;
    private Steema.TeeChart.Tools.AxisBreaksTool axisBreaksTool;
  }
}

[MainForm.cs]

using System;
using System.Windows.Forms;
using Steema.TeeChart.Tools;

namespace GuiTestbench
{
  public partial class MainForm : Form
  {
    public MainForm()
    {
      InitializeComponent();
    }

    private void MainForm_Load(object sender, EventArgs e)
    {
      fastLine1.FillSampleValues();

      var axisBreak = new AxisBreak(axisBreaksTool)
      {
        Enabled = true,
        StartValue = 8,
        EndValue = 10,
        Style = AxisBreakStyle.Line
      };
    }
  }
}

Attachments
corrupt_labels.png
corrupt_labels.png (51.68 KiB) Viewed 4430 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Axis Breaks and corrupt axis labels

Post by Sandra » Thu Jul 19, 2012 2:17 pm

Hello Pilipp P.

The problem of overlaping of AxisBreaks can be solved of many ways,e.g:

1.- Changing the size of GapSize, adapting it to your labels space.
2.- Changing the scale of Axes.
3.- Changing the angle of labels.
4.- Using custom labels, etc.

Basically, you need treat this problem as you treat anyone of problems to overlap as do in this thread.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply