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;
}
OS : Win 7 professional
.net version : 3.5
visual studio 2008
lang. : c#
can you please help me on this issue?
Regards,
Namit Shah