Page 1 of 1

Axis Breaks and corrupt axis labels

Posted: Mon Jul 16, 2012 1:50 pm
by 15658113
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

Re: Axis Breaks and corrupt axis labels

Posted: Mon Jul 16, 2012 1:57 pm
by narcis
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.

Re: Axis Breaks and corrupt axis labels

Posted: Wed Jul 18, 2012 12:05 pm
by 15658113
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
      };
    }
  }
}


Re: Axis Breaks and corrupt axis labels

Posted: Thu Jul 19, 2012 2:17 pm
by 10050769
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,