Axis Break tool with datetime in X axis

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
BNF Tech Inc.
Newbie
Newbie
Posts: 9
Joined: Mon Dec 05, 2011 12:00 am
Contact:

Axis Break tool with datetime in X axis

Post by BNF Tech Inc. » Mon Jun 18, 2012 6:52 am

Hi,

I am trying to use Axis break tool with steema line chart. my x axis have datetime and y axis have value.
but every time I run my project tchart crashed. :(

Code: Select all

 private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            //InitializeChart.
            tChart1.Series.Clear();

            DataTable dt = new DataTable();
            dt.Columns.Add("YH01_CO_1MS-TT04A");
            dt.Columns.Add("DATETIME",typeof(DateTime));

            dt.Rows.Add(new object[] { "39,355,408", "06/01/2012" });
            dt.Rows.Add(new object[] { "87,831,335", "06/02/2012" });
            dt.Rows.Add(new object[] { "144,763,408", "06/03/2012" });
            dt.Rows.Add(new object[] { "144,662,737", "06/04/2012" });
            dt.Rows.Add(new object[] { "119,927,461", "06/05/2012" });
            dt.Rows.Add(new object[] { "91,398,604", "06/06/2012" });
            dt.Rows.Add(new object[] { "38,522,013", "06/07/2012" });
            dt.Rows.Add(new object[] { "34,226,876", "06/08/2012" });

            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
        
            line1.XValues.DateTime = true;
            line1.DateTimeFormat = "MM/dd/yyyy";
            line1.Pointer.Visible = true;
            line1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Hexagon;
            line1.Title = dt.Columns[0].Caption;
            line1.DataSource = dt;
            line1.LabelMember = "DATETIME";
            line1.YValues.DataMember = dt.Columns[0].Caption;
            line1.XValues.DataMember = "DATETIME";
            line1.Color = Color.Red;
            line1.CheckDataSource();

            //AxesBreaks. 
            Steema.TeeChart.Tools.AxisBreaksTool axisbreak = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
            Steema.TeeChart.Tools.AxisBreak axisBreak1 = new Steema.TeeChart.Tools.AxisBreak(axisbreak);
            //Steema.TeeChart.Tools.AxisBreak axisBreak2 = new Steema.TeeChart.Tools.AxisBreak(axisbreak);
            axisBreak1.StartValue = Convert.ToDateTime("06/05/2012").ToOADate();
            axisBreak1.EndValue = Convert.ToDateTime("06/07/2012").ToOADate();
            //axisBreak2.StartValue = DateTime.Today.AddDays(10).ToOADate();
            //axisBreak2.EndValue = DateTime.Today.AddDays(15).ToOADate();
            axisbreak.Axis = tChart1.Axes.Bottom;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "MM/dd/yyyy";
            axisbreak.GapSize = 20;
            tChart1.Axes.Bottom.Labels.Angle = 90;
        }
Environment Information

OS : Win 7 professional
.net version : 3.5
visual studio 2008
lang. : c#

can you please help me on this issue?

Regards,
Namit Shah

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

Re: Axis Break tool with datetime in X axis

Post by Sandra » Mon Jun 18, 2012 12:20 pm

Hello Namit,

I suggest you take a look in this thread where there is an example as you do to use Tool Axis Breaks correctly.

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

BNF Tech Inc.
Newbie
Newbie
Posts: 9
Joined: Mon Dec 05, 2011 12:00 am
Contact:

Re: Axis Break tool with datetime in X axis

Post by BNF Tech Inc. » Mon Jun 18, 2012 12:46 pm

Hi Sandra,

first of all, thanks for your reply.
Basically I started my devlopement from that thread only.

Your code in that thread ,working fine.
I just replace candle series with line series and I take data from datatable instead of using fillsamplevalues() method.
but its not working :(

Can you please figureout what exactly cause of error tchart crashing?

Regards,
Namit Shah

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

Re: Axis Break tool with datetime in X axis

Post by Sandra » Tue Jun 19, 2012 4:20 pm

Hello Namit,

I haven't forgotten you. We are investigating why your problem occurs and we try to answer you asap.

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

BNF Tech Inc.
Newbie
Newbie
Posts: 9
Joined: Mon Dec 05, 2011 12:00 am
Contact:

Re: Axis Break tool with datetime in X axis

Post by BNF Tech Inc. » Wed Jun 20, 2012 1:55 pm

Hi Sandra,

I am stuck in this situation :(
I have deadline to complete it.

Can you please give me any workaround or solution of this problem as soon as possible?

Thanks!

Regards,
Namit Shah

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

Re: Axis Break tool with datetime in X axis

Post by Sandra » Mon Jun 25, 2012 3:15 pm

Hello Namit,

Sorry for the delay. Finally, I have found the problem and seems it must be caused for the assignation the "DATETIME" to DataLabelMamber and the order of you add values. To solve the problem I have removed the assignation and change the order of DateTime values and now your code works fine for me.

Code: Select all

        private void InitializeChart()
        {

            tChart1.Aspect.View3D = false;
            //InitializeChart.
            tChart1.Series.Clear();
            DateTime DateNow = DateTime.Now;
            DataTable dt = new DataTable();
            dt.Columns.Add("DATETIME", Type.GetType("System.DateTime"));
            dt.Columns.Add("YH01_CO_1MS-TT04A", Type.GetType("System.Double"));

            dt.Rows.Add(new object[] { "06/01/2012", "39,355,408" });
            dt.Rows.Add(new object[] { "06/02/2012", "87,831,335", });
            dt.Rows.Add(new object[] { "06/03/2012", "144,763,408" });
            dt.Rows.Add(new object[] { "06/04/2012", "144,662,737" });
            dt.Rows.Add(new object[] { "06/05/2012", "119,927,461", });
            dt.Rows.Add(new object[] { "06/06/2012", "91,398,604" });
            dt.Rows.Add(new object[] { "06/07/2012", "38,522,013" });
            dt.Rows.Add(new object[] { "06/08/2012", "34,226,876" });
         
            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            //Remove DataLabelMember. 
            line1.XValues.DateTime = true;
            line1.DateTimeFormat = "MM/dd/yyyy";
            line1.Pointer.Visible = true;
            line1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Hexagon;
            line1.Title = dt.Columns[0].Caption;
            line1.DataSource = dt;
            line1.YValues.DataMember = dt.Columns[0].Caption;
            line1.XValues.DataMember = "DATETIME";
            line1.Color = Color.Red;
            line1.CheckDataSource();
    
            Steema.TeeChart.Tools.AxisBreaksTool axisbreak = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
            Steema.TeeChart.Tools.AxisBreak axisBreak1 = new Steema.TeeChart.Tools.AxisBreak(axisbreak);
            Steema.TeeChart.Tools.AxisBreak axisBreak2 = new Steema.TeeChart.Tools.AxisBreak(axisbreak);
            axisBreak1.StartValue = line1.XValues[3];
            axisBreak1.EndValue = line1.XValues[6];
            //axisBreak2.StartValue = DateTime.Today.AddDays(4).ToOADate();
            //axisBreak2.EndValue = DateTime.Today.AddDays(6).ToOADate();
            axisbreak.Axis = tChart1.Axes.Bottom;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "MM/dd/yyyy";
            //tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(DateTimeSteps.OneDay);
            axisbreak.GapSize = 20;
            tChart1.Axes.Bottom.Labels.Angle = 90;
        }
Can you tell us if previous code works as you want?

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

BNF Tech Inc.
Newbie
Newbie
Posts: 9
Joined: Mon Dec 05, 2011 12:00 am
Contact:

Re: Axis Break tool with datetime in X axis

Post by BNF Tech Inc. » Wed Jun 27, 2012 12:16 pm

Hi Sandra,

Yes your code working fine after some modification.
Thanks for your help. :)

Regards,
Namit Shah

BNF Tech Inc.
Newbie
Newbie
Posts: 9
Joined: Mon Dec 05, 2011 12:00 am
Contact:

Re: Axis Break tool with datetime in X axis

Post by BNF Tech Inc. » Sat Aug 04, 2012 11:57 am

Hi Sandra,

I found strange new problem with your solution.

If I use tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:mm"...all the bottom labels are disappeared from chart.

To reproduce the problem ,please use below code.

Code: Select all

private void InitializeChart()
        {

            tChart1.Aspect.View3D = false;
            //InitializeChart.
            tChart1.Series.Clear();
            DateTime DateNow = DateTime.Now;
            DataTable dt = new DataTable();
            dt.Columns.Add("DATETIME", Type.GetType("System.DateTime"));
            dt.Columns.Add("YH01_CO_1MS-TT04A", Type.GetType("System.Double"));

            dt.Rows.Add(new object[] { "06/01/2012 14:00", "39,355,408" });
            dt.Rows.Add(new object[] { "06/01/2012 15:00", "87,831,335", });
            dt.Rows.Add(new object[] { "06/01/2012 16:00", "144,763,408" });
            dt.Rows.Add(new object[] { "06/01/2012 17:00", "144,662,737" });
            dt.Rows.Add(new object[] { "06/01/2012 18:00", "119,927,461", });
            dt.Rows.Add(new object[] { "06/01/2012 19:00", "91,398,604" });
            dt.Rows.Add(new object[] { "06/01/2012 20:00", "38,522,013" });
            dt.Rows.Add(new object[] { "06/01/2012 21:00", "34,226,876" });

            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            //Remove DataLabelMember. 
            line1.XValues.DateTime = true;
            line1.DateTimeFormat = "MM/dd/yyyy";
            line1.Pointer.Visible = true;
            line1.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Hexagon;
            line1.Title = dt.Columns[0].Caption;
            line1.DataSource = dt;
            line1.YValues.DataMember = dt.Columns[0].Caption;
            line1.XValues.DataMember = "DATETIME";
            line1.Color = Color.Red;
            line1.CheckDataSource();

            Steema.TeeChart.Tools.AxisBreaksTool axisbreak = new Steema.TeeChart.Tools.AxisBreaksTool(tChart1.Chart);
            Steema.TeeChart.Tools.AxisBreak axisBreak1 = new Steema.TeeChart.Tools.AxisBreak(axisbreak);
            Steema.TeeChart.Tools.AxisBreak axisBreak2 = new Steema.TeeChart.Tools.AxisBreak(axisbreak);
            axisBreak1.StartValue = line1.XValues[3];
            axisBreak1.EndValue = line1.XValues[6];
            //axisBreak2.StartValue = DateTime.Today.AddDays(4).ToOADate();
            //axisBreak2.EndValue = DateTime.Today.AddDays(6).ToOADate();
            axisbreak.Axis = tChart1.Axes.Bottom;
            tChart1.Axes.Bottom.Labels.DateTimeFormat = "HH:mm";//"MM/dd/yyyy";
            //tChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(DateTimeSteps.OneDay);
            axisbreak.GapSize = 20;
            tChart1.Axes.Bottom.Labels.Angle = 90;
        }
PLease see attached scrren shot of problem.

Can you please help me on this issue?

Regards,
Namit Shah
Attachments
axis-break.png
Screen shot of Problem
axis-break.png (90.14 KiB) Viewed 8687 times

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

Re: Axis Break tool with datetime in X axis

Post by Sandra » Tue Aug 07, 2012 10:41 am

Hello Namit,

After doing many test, I have added your problem in the bug list report with number[TF02016292] to investigate the problem and try to fix it to upcoming versions of TeeChartFor.Net.

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