X-Axis have two zero labels

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
sim
Newbie
Newbie
Posts: 19
Joined: Wed Jul 30, 2008 12:00 am

X-Axis have two zero labels

Post by sim » Mon Dec 05, 2011 4:48 am

I'm developing an application in .Net 3.5 in VS 2010, using TeeChart Pro v 3.5.3225.32185.
I add two pointSeries:(2.739E-06,404521.65),(2.113E-05,5467.59) and a LineSeries that its points are (4.45E-08,404521.65),(4.45E-08,2.739E-06).There have Bottom axis and Left axis.All axes 's Logarithm is true,and AxisLabelStyle is Value. But the X-axis have two "0.00E+000" labels.Is this a Tchart's bug?I will highly appreciate your help. Thanks in Advance.

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Steema.TeeChart;
using System.Drawing.Drawing2D;
using Steema.TeeChart.Styles;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        private TChart _tChart = new Steema.TeeChart.TChart();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Controls.Add(_tChart);
            _tChart.Dock = DockStyle.Fill;
            _tChart.Aspect.View3D = false;
            _tChart.Panel.MarginBottom = 1;
            _tChart.Panel.MarginLeft = 1;
            _tChart.Panel.MarginRight = 5;
            _tChart.Panel.MarginTop = 1;
            _tChart.Walls.Back.Transparent = true;
                //build pointSeries
            string pointXYString = "2.739E-06,404521.65|2.113E-05,5467.59";
            string[] pointValues = pointXYString.Split('|');
            DataTable dt = new DataTable();
            dt.Columns.Add("X", typeof(double));
            dt.Columns.Add("Y", typeof(double));
            for (int i = 0; i < pointValues.Length; i++)
            {
                string[] pointValue = pointValues[i].Split(',');
                DataRow dr = dt.NewRow();
                dr[0] = pointValue[0];
                dr[1] = pointValue[1];
                dt.Rows.Add(dr);
            }
            var points = new Points();
            points.Title = "TestPointSeries";
            points.Visible = true;
            points.Marks.Text = "";
            points.Pointer.Style = PointerStyles.Circle;

            points.Pointer.Visible = true;
            points.DataSource = dt;

            points.ColorEach = true;
            points.LabelMember = string.Empty;
            points.XValues.DataMember = "X";
            points.YValues.DataMember = "Y";
 
            _tChart.Series.Add(points);

            string lineXYString = "4.45E-08,404521.65|4.45E-08,2.739E-06";
            string[] lineValues = lineXYString.Split('|');
            DataTable dt2 = new DataTable();
            dt2.Columns.Add("X", typeof(double));
            dt2.Columns.Add("Y", typeof(double));
            for (int i = 0; i < lineValues.Length; i++)
            {
                string[] lineValue = lineValues[i].Split(',');
                DataRow dr = dt2.NewRow();
                dr[0] = lineValue[0];
                dr[1] = lineValue[1];
                dt2.Rows.Add(dr);
            }
            var line = new Line();
            line.Title = "TestLineSeries";

            line.OutLine.Style = DashStyle.Solid;
            line.Active = true;
            line.Visible = true;
            line.Pointer.Visible = true;
            line.LinePen.Width = 4;
            line.LinePen.Style = DashStyle.Custom;
            line.Pointer.Style = PointerStyles.Nothing;
            line.Color = Color.Red;
            line.Marks.Text = string.Empty;
            line.DataSource = dt2;
            line.XValues.DataMember = "X";
            line.YValues.DataMember = "Y";
            _tChart.Series.Add(line);

            //set Axes
            _tChart.Axes.Bottom.Logarithmic = true;
            _tChart.Axes.Bottom.LogarithmicBase = 10;
            _tChart.Axes.Bottom.Automatic = true;
            _tChart.Axes.Bottom.AutomaticMaximum = false;
            _tChart.Axes.Bottom.AutomaticMinimum = false;
            _tChart.Axes.Bottom.MinorTickCount = 9;
            _tChart.Axes.Bottom.Labels.Style =  AxisLabelStyle.Value;
            _tChart.Axes.Bottom.Labels.ValueFormat = "#.000E+0000";

            _tChart.Axes.Left.Logarithmic = true;
            _tChart.Axes.Left.LogarithmicBase = 10;
            _tChart.Axes.Left.Automatic = true;
            _tChart.Axes.Left.AutomaticMaximum = false;
            _tChart.Axes.Left.AutomaticMinimum = false;
            _tChart.Axes.Left.MinorTickCount = 9;
            _tChart.Axes.Left.Labels.Style = AxisLabelStyle.Value;
            _tChart.Axes.Left.Labels.ValueFormat = "#.0000E+00";
        }
    }
}

Attachments
twozero.jpg
X-Axis have two zero labels
twozero.jpg (76.49 KiB) Viewed 6866 times
XAxisLabelText.zip
My Test project
(47.13 KiB) Downloaded 430 times

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

Re: X-Axis have two zero labels

Post by Narcís » Mon Dec 05, 2011 11:50 am

Hello,

This works fine for me here using latest TeeChart for .NET v3 build (3.5.3700.30574/5) available at the client download area as you can see in the screen-shot below. Can you please check if this solves the problem at your end?
LogLabels.jpg
LogLabels.jpg (130.25 KiB) Viewed 6857 times
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

sim
Newbie
Newbie
Posts: 19
Joined: Wed Jul 30, 2008 12:00 am

Re: X-Axis have two zero labels

Post by sim » Tue Dec 06, 2011 2:07 am

I have download "TeeChartNET3UpdateBuild.exe" and update my Teechart version to 3.5.3700.30575. But it can't solve the problem.
1. I found our X-Axis's scale is not the same. Does our Teechart's version is not the same? Please refor "tchartVersion.jpg".
2. The PointSeries have two points:(2.739E-06,404521.65) and (2.113E-05,5467.59). Their X values are 2.739E-06 and 2.113E-05, but the points X value is between 1E-0003 and 1E-0001 in your screen-shot.
Thanks in advance.
Attachments
tchartVersion.jpg
My Tchart's Version
tchartVersion.jpg (73.39 KiB) Viewed 6826 times

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

Re: X-Axis have two zero labels

Post by Sandra » Tue Dec 06, 2011 12:20 pm

Hello STar,

Ok I can reproduce it using last version 3 but not in last version 2011 of TeeChart.Net. I think you can solve your problem adding Column of labels in your dataset and using Column["Labels"] as labels in your Bottom Axis. I have modified your project, because, it works with labels in the Bottom Axis:

Code: Select all

       private TChart _tChart = new Steema.TeeChart.TChart();
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Controls.Add(_tChart);
            _tChart.Dock = DockStyle.Fill;
            _tChart.Aspect.View3D = false;
            _tChart.Panel.MarginBottom = 1;
            _tChart.Panel.MarginLeft = 1;
            _tChart.Panel.MarginRight = 5;
            _tChart.Panel.MarginTop = 1;
            _tChart.Walls.Back.Transparent = true;
            CreateData();
            SetAxes();
        }
       private void CreateData()
        {
                //build pointSeries
            string pointXYString = "2.739E-06,404521.65|2.113E-05,5467.59";
            string[] pointValues = pointXYString.Split('|');
            DataTable dt = new DataTable();
            dt.Columns.Add("X", typeof(double));
            dt.Columns.Add("Y", typeof(double));
            dt.Columns.Add("Labels", typeof(string));
            for (int i = 0; i < pointValues.Length; i++)
            {
                string[] pointValue = pointValues[i].Split(',');
                DataRow dr = dt.NewRow();
                dr[0] = pointValue[0];
                dr[1] = pointValue[1];
                dr["Labels"] = dr[0].ToString();
                dt.Rows.Add(dr);
            }
            var points = new Points();
            points.Title = "TestPointSeries";
            points.Visible = true;
            points.Marks.Text = "";
            points.Pointer.Style = PointerStyles.Circle;

            points.Pointer.Visible = true;
            points.DataSource = dt;

            points.ColorEach = true;
            points.LabelMember = string.Empty;
            points.XValues.DataMember = "X";
            points.YValues.DataMember = "Y";
            points.LabelMember = "Labels";
 
            _tChart.Series.Add(points);

            string lineXYString = "4.45E-08,404521.65|4.45E-08,2.739E-06";
            string[] lineValues = lineXYString.Split('|');
            DataTable dt2 = new DataTable();
            dt2.Columns.Add("X", typeof(double));
            dt2.Columns.Add("Y", typeof(double));
            dt2.Columns.Add("Labels", typeof(string)); 
            for (int i = 0; i < lineValues.Length; i++)
            {
                string[] lineValue = lineValues[i].Split(',');
                DataRow dr = dt2.NewRow();
                dr[0] = lineValue[0];
                dr[1] = lineValue[1];
                dr["Labels"] = dr[0].ToString();
                dt2.Rows.Add(dr);
            }

            var line = new Line();
            line.Title = "TestLineSeries";

            line.OutLine.Style = DashStyle.Solid;
            line.Active = true;
            line.Visible = true;
            line.Pointer.Visible = true;
            line.LinePen.Width = 4;
            line.LinePen.Style = DashStyle.Custom;
            line.Pointer.Style = PointerStyles.Nothing;
            line.Color = Color.Red;
            line.Marks.Text = string.Empty;
            line.DataSource = dt2;
            line.XValues.DataMember = "X";
            line.YValues.DataMember = "Y";
            line.LabelMember = "Labels";
            _tChart.Series.Add(line);
            }

        private void SetAxes()
        {
         
            _tChart.Axes.Bottom.Labels.Style =  AxisLabelStyle.Text;
            _tChart.Axes.Bottom.Labels.ValueFormat = "#.000E+0000";

            _tChart.Axes.Left.Logarithmic = true;
            _tChart.Axes.Left.LogarithmicBase = 10;
            _tChart.Axes.Left.Automatic = true;
            _tChart.Axes.Left.AutomaticMaximum = false;
            _tChart.Axes.Left.AutomaticMinimum = false;
            _tChart.Axes.Left.MinorTickCount = 9;
          
            _tChart.Axes.Left.Labels.Style = AxisLabelStyle.Value;
           _tChart.Axes.Left.Labels.ValueFormat = "#.0000E+00";
      }  
Please can you confirm us if previous code help you to solve your problem? On the other hand, if solution doesn't like, I suggest you use CustomLabels, you can find examples in Demo project concretely in the All Features\Welcome !\Axes\Labels\Custom labels.

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

sim
Newbie
Newbie
Posts: 19
Joined: Wed Jul 30, 2008 12:00 am

Re: X-Axis have two zero labels

Post by sim » Wed Jan 18, 2012 10:02 am

the Custom label can fix this issues,but it brought new problems:http://www.teechart.net/support/viewtop ... 55&start=0

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

Re: X-Axis have two zero labels

Post by Sandra » Thu Jan 19, 2012 11:50 am

Hello sim,

Please, take a look my answer in this thread.

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