Bottom and Custom Vertical Axis Label Start Position
Bottom and Custom Vertical Axis Label Start Position
Hi,
I am facing issue of starting the X-axis label value from the leftmost position of the chart and same for all Y-axis.
I have checked below request and implemented same. However, it doesn't solve my issue. Please suggest.
http://www.teechart.net/support/viewtop ... 74&p=70489
Attached sample project for your reference.
Thanks
I am facing issue of starting the X-axis label value from the leftmost position of the chart and same for all Y-axis.
I have checked below request and implemented same. However, it doesn't solve my issue. Please suggest.
http://www.teechart.net/support/viewtop ... 74&p=70489
Attached sample project for your reference.
Thanks
- Attachments
-
- Trend.zip
- (4.68 KiB) Downloaded 662 times
-
- Trend.png (27.46 KiB) Viewed 19575 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
Hello Priyanka,
Many thanks.
Unfortunately your sample project is not a Minimal, Complete, and Verifiable example because it uses data to which we do not have access. Would you please be so kind as to create a Minimal, Complete, and Verifiable example which includes your attempts to implement the solution you saw in these forums?Priyanka wrote: I have checked below request and implemented same. However, it doesn't solve my issue. Please suggest.
http://www.teechart.net/support/viewtop ... 74&p=70489
Attached sample project for your reference.
Many thanks.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
Attached modified sample project. However, the data is kept as is to show another issue of setting min and max at Y-axis. You can see data point values in legend.
Thanks.
Attached modified sample project. However, the data is kept as is to show another issue of setting min and max at Y-axis. You can see data point values in legend.
Thanks.
- Attachments
-
- Code.zip
- Code
- (3.69 KiB) Downloaded 669 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
Hello,
I'm using the latest version of TeeChart.dll in Windows Forms with this code:
And the result is this:
Is this what you would expect?
Also, I cannot see in this code any attempt to implement the solution you mentioned in your first message in this thread - should I be able to see in this code where you have attempted to implement it?
I'm using the latest version of TeeChart.dll in Windows Forms with this code:
Code: Select all
private void InitializeChart()
{
string strTrenddata = string.Empty;
try
{
string chart_title = "";
// Set chart basic properties
tChart1.Chart.Aspect.View3D = false;
tChart1.Chart.Header.Visible = true;
tChart1.Chart.Header.Text = chart_title;
tChart1.Chart.Legend.Alignment = LegendAlignments.Bottom;
tChart1.Chart.Legend.Visible = true;
Steema.TeeChart.Axis bottomAxis = tChart1.Chart.Axes.Bottom;
bottomAxis.Grid.Visible = false;
tChart1.Chart.Panel.Gradient.Visible = false;
tChart1.Chart.Panel.Color = Color.White;
//Do doesn't visible Wall Back
tChart1.Chart.Walls.Back.Visible = false;
tChart1.Chart.Walls.Back.Color = Color.White;
new Steema.TeeChart.Styles.Line(tChart1.Chart);
double maxvalue = 0;
strTrenddata = "<TrendData xmlns='http://www.test.com/TrendData.xsd'><TrendDataSet><TimeStamp>2016-04-06T10:53:12+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:54:04+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:54:57+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:55:50+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:56:42+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:57:35+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:58:28+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:59:20+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:00:13+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:01:06+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:01:58+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:02:51+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:03:44+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:04:37+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:05:29+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:06:22+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:07:15+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:08:07+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:09:00+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:09:53+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:10:45+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:11:38+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:12:31+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:13:23+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:14:16+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:15:09+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:16:02+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:16:54+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:17:47+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:18:40+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:19:32+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:20:25+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:21:18+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:22:10+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>85.41893</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:23:03+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:23:56+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:24:48+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:25:41+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:26:34+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:27:27+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:28:19+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:29:12+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:30:05+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:30:57+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:31:50+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:32:43+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:33:35+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:34:28+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:35:21+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:36:14+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet></TrendData>";
tChart1.Chart[0].DataSource = GetData("_x0031_120BXA001_x002F_OUT.CV", strTrenddata, out maxvalue);//Add values using DataSource
// X-axis setting
tChart1.Chart[0].XValues.DataMember = "DateTime";
tChart1.Chart[0].XValues.DateTime = true;
tChart1.Chart.Axes.Custom.Add(new Steema.TeeChart.Axis(tChart1.Chart));
tChart1.Chart[0].CustomVertAxis = tChart1.Chart.Axes.Custom[0];
bottomAxis.Labels.DateTimeFormat = "yyyy-dd-MM\nHH:mm";
bottomAxis.Labels.Angle = 90;
tChart1.Chart.Axes.Custom[0].AxisPen.Width = 1;
tChart1.Chart.Axes.Custom[0].AxisPen.Color = tChart1.Chart[0].Color;
tChart1.Chart.Axes.Custom[0].Grid.Visible = false;
tChart1.Chart.Axes.Custom[0].Title.Visible = false;
tChart1.Chart[0].CustomVertAxis.Automatic = true;
tChart1.Chart[0].CustomVertAxis.SetMinMax(0, maxvalue);
tChart1.Chart.Axes.Custom[0].Title.Caption = "";
tChart1.Chart.Axes.Custom[0].Title.Angle = 90;
tChart1.Chart[0].YValues.DataMember = "SystemName";
tChart1.Chart[0].CustomVertAxis.Labels.ValueFormat = "####;{####}";
tChart1.Chart.Axes.Custom[0].PositionUnits = PositionUnits.Pixels;
panel1.Width = 1100;
panel1.Height = 600;
tChart1.Chart.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
PlaceAxes(0, 0, 0, 0, 0);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
catch (Exception ex)
{
}
}
private DataSet GetData(string TagName, string strTrenddata, out double maxvalue)
{
XmlDocument doc = new XmlDocument();
DataSet TeeDataSet = new DataSet();
DateTime dt = DateTime.Today;
Int32 maxVal = 0;
try
{
doc.LoadXml(strTrenddata);
maxvalue = 0;
DataTable TeeDataTable = new DataTable("DataTable1");
DataColumn xval = new DataColumn("DateTime", typeof(DateTime));
DataColumn yval = new DataColumn("SystemName", typeof(double));
TeeDataTable.Columns.Add(xval);
TeeDataTable.Columns.Add(yval);
TagName = TagName.Split('/')[0];
XmlDocument pardoc = new XmlDocument();
foreach (XmlNode xnList in doc.SelectNodes("/*[local-name()='TrendData']/*[local-name()='TrendDataSet']"))
{
foreach (XmlNode xnList1 in xnList.ChildNodes)
{
string str = xnList1.Name;
XmlNode parentnode = xnList1.ParentNode;
pardoc.LoadXml(parentnode.OuterXml);
if (str == TagName)
{
//add
DataRow newRow = TeeDataTable.NewRow();
newRow[xval] = pardoc.SelectSingleNode("/*[local-name()='TrendDataSet']/*[local-name()='TimeStamp']").InnerText;
newRow[yval] = xnList1.InnerText;
TeeDataTable.Rows.Add(newRow);
}
}
}
TeeDataSet.Tables.Add(TeeDataTable);
var maxVal1 = TeeDataTable.AsEnumerable()
.Max(r => r.Field<double>("SystemName"));
maxVal = Convert.ToInt32(maxVal1);
}
catch (Exception ex)
{
}
maxvalue = maxVal;
return TeeDataSet;
}
protected void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
PlaceAxes(0, 0, 0, 0, 0);
//set x position for new label
int x = tChart1.Chart.Axes.Bottom.CalcPosValue(tChart1.Chart.Axes.Bottom.Minimum);
AxisLabels tmpLabels = new AxisLabels(tChart1.Chart.Axes.Bottom);
FieldInfo privateField = tmpLabels.GetType().GetField("position", BindingFlags.NonPublic | BindingFlags.Instance);
int y = (int)privateField.GetValue(tChart1.Chart.Axes.Bottom.Labels);
string label = tChart1.Chart.Axes.Bottom.Minimum.ToString("#");
//output text
//g.TextOut(x - ((int)Math.Round(g.TextWidth(label) / 2)), y, label);
// It print to number. I need it to shift the start date??
}
private void PlaceAxes(int nSeries, int NextXLeft, int NextXRight, int MargLeft, int MargRight)
{
const int extraPos = 12;
const int extraMargin = 50;
Steema.TeeChart.Chart ch1 = tChart1.Chart;
//Variable
int MaxLabelsWidth;
int lenghtTicks;
int extraSpaceBetweenTitleAndLabels;
foreach (Steema.TeeChart.Styles.Line s in ch1.Series)
{
if (s.CustomVertAxis != null)
{
MaxLabelsWidth = s.CustomVertAxis.MaxLabelsWidth();
lenghtTicks = s.CustomVertAxis.Ticks.Length;
extraSpaceBetweenTitleAndLabels = (s.CustomVertAxis.Title.Width);//- tChart1.Axes.Custom[nSeries].MaxLabelsWidth());
if (s.CustomVertAxis.Title.Visible)
{
s.CustomVertAxis.RelativePosition = NextXLeft;
NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraSpaceBetweenTitleAndLabels + extraPos);
MargLeft = MargLeft + extraMargin;
}
else
{
s.CustomVertAxis.RelativePosition = NextXLeft;
if (ch1.Series.Count == 3)
NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraPos);
else
NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraPos + 25);
MargLeft = MargLeft + extraMargin;
}
}
ch1.Panel.MarginLeft = MargLeft;
}
}
Is this what you would expect?
Also, I cannot see in this code any attempt to implement the solution you mentioned in your first message in this thread - should I be able to see in this code where you have attempted to implement it?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
The issue is starting position of X-axis and Y-axis values. I would expect the chart as per attached. Also, the code I tried is in tChart1_AfterDraw method.
Thanks.
The issue is starting position of X-axis and Y-axis values. I would expect the chart as per attached. Also, the code I tried is in tChart1_AfterDraw method.
Thanks.
- Attachments
-
- Trend1.png (257.71 KiB) Viewed 19531 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
Yes, okay. What I'm trying to say is that I would expect you to have tried coding the technique specified in the reply to this message here, but I can't see any code in your example which makes any attempt to do so.Priyanka wrote: The issue is starting position of X-axis and Y-axis values. I would expect the chart as per attached. Also, the code I tried is in tChart1_AfterDraw method.
Have you tried using this technique to resolve the problem? If so, do you have an example of the problems you encountered?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
I tried to implement technique as mentioned in your reply. However, it is showing just one value as shown in the screenshot. Also, Y-axis values are not started from the same position.
I tried to implement technique as mentioned in your reply. However, it is showing just one value as shown in the screenshot. Also, Y-axis values are not started from the same position.
- Attachments
-
- Trend.png (23.56 KiB) Viewed 19489 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
Could you please pass me your code so I can try and reproduce your issues here?Priyanka wrote: I tried to implement technique as mentioned in your reply. However, it is showing just one value as shown in the screenshot. Also, Y-axis values are not started from the same position.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
Please find attached code for your reference. Also, can you check the issue of displaying 0 value on Y-axis.
Thanks
Please find attached code for your reference. Also, can you check the issue of displaying 0 value on Y-axis.
Thanks
- Attachments
-
- Code.zip
- (3.83 KiB) Downloaded 610 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
Many apologies for the delay in this reply - Friday and Monday were holidays here.Priyanka wrote: Please find attached code for your reference. Also, can you check the issue of displaying 0 value on Y-axis.
I'm using the following code and the latest version of TeeChart.dll in a Windows Forms project:
Code: Select all
private void InitializeChart()
{
string strTrenddata = string.Empty;
try
{
string chart_title = "";
// Set chart basic properties
tChart1.Chart.Aspect.View3D = false;
tChart1.Chart.Header.Visible = true;
tChart1.Chart.Header.Text = chart_title;
tChart1.Chart.Legend.Alignment = LegendAlignments.Bottom;
tChart1.Chart.Legend.Visible = true;
Steema.TeeChart.Axis bottomAxis = tChart1.Chart.Axes.Bottom;
bottomAxis.Grid.Visible = false;
tChart1.Chart.Panel.Gradient.Visible = false;
tChart1.Chart.Panel.Color = Color.White;
//Do doesn't visible Wall Back
tChart1.Chart.Walls.Back.Visible = false;
tChart1.Chart.Walls.Back.Color = Color.White;
new Steema.TeeChart.Styles.Line(tChart1.Chart);
double maxvalue = 0;
strTrenddata = "<TrendData xmlns='http://www.test.com/TrendData.xsd'><TrendDataSet><TimeStamp>2016-04-06T10:53:12+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:54:04+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:54:57+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:55:50+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:56:42+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:57:35+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:58:28+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T10:59:20+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:00:13+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:01:06+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:01:58+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:02:51+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:03:44+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:04:37+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:05:29+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:06:22+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:07:15+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:08:07+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:09:00+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:09:53+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:10:45+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:11:38+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:12:31+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:13:23+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:14:16+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:15:09+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:16:02+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:16:54+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:17:47+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:18:40+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:19:32+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:20:25+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:21:18+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:22:10+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>85.41893</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:23:03+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:23:56+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:24:48+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>36</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:25:41+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:26:34+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:27:27+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:28:19+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:29:12+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:30:05+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:30:57+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:31:50+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:32:43+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:33:35+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:34:28+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:35:21+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet><TrendDataSet><TimeStamp>2016-04-06T11:36:14+02:00</TimeStamp><_x0031_120BXA001_x002F_OUT.CV>96</_x0031_120BXA001_x002F_OUT.CV><_x0031_120BXA001_x002F_OUT.CV_Status>0</_x0031_120BXA001_x002F_OUT.CV_Status></TrendDataSet></TrendData>";
tChart1.Chart[0].DataSource = GetData("_x0031_120BXA001_x002F_OUT.CV", strTrenddata, out maxvalue);//Add values using DataSource
// X-axis setting
tChart1.Chart[0].XValues.DataMember = "DateTime";
tChart1.Chart[0].XValues.DateTime = true;
tChart1.Chart.Axes.Custom.Add(new Steema.TeeChart.Axis(tChart1.Chart));
tChart1.Chart[0].CustomVertAxis = tChart1.Chart.Axes.Custom[0];
bottomAxis.Labels.DateTimeFormat = "yyyy-dd-MM\nHH:mm";
bottomAxis.Labels.Angle = 90;
tChart1.Chart.Axes.Custom[0].AxisPen.Width = 1;
tChart1.Chart.Axes.Custom[0].AxisPen.Color = tChart1.Chart[0].Color;
tChart1.Chart.Axes.Custom[0].Grid.Visible = false;
tChart1.Chart.Axes.Custom[0].Title.Visible = false;
tChart1.Chart[0].CustomVertAxis.Automatic = true;
tChart1.Chart[0].CustomVertAxis.SetMinMax(0, maxvalue);
tChart1.Chart.Axes.Custom[0].Title.Caption = "";
tChart1.Chart.Axes.Custom[0].Title.Angle = 90;
tChart1.Chart[0].YValues.DataMember = "SystemName";
tChart1.Chart[0].CustomVertAxis.Labels.ValueFormat = "####;{####}";
tChart1.Chart.Axes.Custom[0].PositionUnits = PositionUnits.Pixels;
tChart1.Chart.Width = 1100;
tChart1.Chart.Height = 600;
tChart1.Chart.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels;
PlaceAxes(0, 0, 0, 0, 0);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(WebChart1_AfterDraw);
tChart1.Chart.Export.Image.PNG.Save(@"D:\tmp\Trend.png");
}
catch (Exception ex)
{
}
}
private DataSet GetData(string TagName, string strTrenddata, out double maxvalue)
{
XmlDocument doc = new XmlDocument();
DataSet TeeDataSet = new DataSet();
DateTime dt = DateTime.Today;
Int32 maxVal = 0;
try
{
doc.LoadXml(strTrenddata);
maxvalue = 0;
DataTable TeeDataTable = new DataTable("DataTable1");
DataColumn xval = new DataColumn("DateTime", typeof(DateTime));
DataColumn yval = new DataColumn("SystemName", typeof(double));
TeeDataTable.Columns.Add(xval);
TeeDataTable.Columns.Add(yval);
TagName = TagName.Split('/')[0];
XmlDocument pardoc = new XmlDocument();
foreach (XmlNode xnList in doc.SelectNodes("/*[local-name()='TrendData']/*[local-name()='TrendDataSet']"))
{
foreach (XmlNode xnList1 in xnList.ChildNodes)
{
string str = xnList1.Name;
XmlNode parentnode = xnList1.ParentNode;
pardoc.LoadXml(parentnode.OuterXml);
if (str == TagName)
{
//add
DataRow newRow = TeeDataTable.NewRow();
newRow[xval] = pardoc.SelectSingleNode("/*[local-name()='TrendDataSet']/*[local-name()='TimeStamp']").InnerText;
newRow[yval] = xnList1.InnerText;
TeeDataTable.Rows.Add(newRow);
}
}
}
TeeDataSet.Tables.Add(TeeDataTable);
var maxVal1 = TeeDataTable.AsEnumerable()
.Max(r => r.Field<double>("SystemName"));
maxVal = Convert.ToInt32(maxVal1);
}
catch (Exception ex)
{
}
maxvalue = maxVal;
return TeeDataSet;
}
protected void WebChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
PlaceAxes(0, 0, 0, 0, 0);
//set x position for new label
int x = tChart1.Chart.Axes.Bottom.CalcPosValue(tChart1.Chart.Axes.Bottom.Minimum);
AxisLabels tmpLabels = new AxisLabels(tChart1.Chart.Axes.Bottom);
FieldInfo privateField = tmpLabels.GetType().GetField("position", BindingFlags.NonPublic | BindingFlags.Instance);
int y = (int)privateField.GetValue(tChart1.Chart.Axes.Bottom.Labels);
string label = tChart1.Chart.Axes.Bottom.Minimum.ToString("#");
//output text
//g.TextOut(x - ((int)Math.Round(g.TextWidth(label) / 2)), y, label);
// It print to number. I need it to shift the start date??
}
private void PlaceAxes(int nSeries, int NextXLeft, int NextXRight, int MargLeft, int MargRight)
{
const int extraPos = 12;
const int extraMargin = 50;
Steema.TeeChart.Chart ch1 = tChart1.Chart;
//Variable
int MaxLabelsWidth;
int lenghtTicks;
int extraSpaceBetweenTitleAndLabels;
foreach (Steema.TeeChart.Styles.Line s in ch1.Series)
{
if (s.CustomVertAxis != null)
{
MaxLabelsWidth = s.CustomVertAxis.MaxLabelsWidth();
lenghtTicks = s.CustomVertAxis.Ticks.Length;
extraSpaceBetweenTitleAndLabels = (s.CustomVertAxis.Title.Width);//- 2016.Axes.Custom[nSeries].MaxLabelsWidth());
if (s.CustomVertAxis.Title.Visible)
{
s.CustomVertAxis.RelativePosition = NextXLeft;
NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraSpaceBetweenTitleAndLabels + extraPos);
MargLeft = MargLeft + extraMargin;
}
else
{
s.CustomVertAxis.RelativePosition = NextXLeft;
if (ch1.Series.Count == 3)
NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraPos);
else
NextXLeft = NextXLeft - (MaxLabelsWidth + lenghtTicks + extraPos + 25);
MargLeft = MargLeft + extraMargin;
}
}
ch1.Panel.MarginLeft = MargLeft;
}
}
Again, I'm afraid cannot see any attempt to implement the coding technique I mentioned in my last message to you. Could you please clarify whether you simply want me to implement this code for you?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
Not sure which code you are referring. However, I had attached code with the below method implemented. I assume this is what you also suggested to fix this issue in other post.
private void WebChart1_BeforeDrawAxes(object sender, Graphics3D g)
Attached again the file with the code recommended.
Appreciate quick help. Thanks.
Not sure which code you are referring. However, I had attached code with the below method implemented. I assume this is what you also suggested to fix this issue in other post.
private void WebChart1_BeforeDrawAxes(object sender, Graphics3D g)
Attached again the file with the code recommended.
Appreciate quick help. Thanks.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
Hello Priyanka,
I think I've got a couple of solutions for you. Firstly the zero that does not appear on the custom axis - this is due to the custom valueformat, which should be changed to this:
and the singular label on the bottom axis was because, for your data, the increment was set too high:
I hope that helps.
I think I've got a couple of solutions for you. Firstly the zero that does not appear on the custom axis - this is due to the custom valueformat, which should be changed to this:
Code: Select all
WebChart1.Chart[0].CustomVertAxis.Labels.ValueFormat = "####0;{####0};
Code: Select all
double inc = 1.0 / 480.0; //five minutes
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
Thanks. It solved both issues
Need your inputs on removing the border (bottom line) marked in attached screenshot (Trend_chart1). We need the border to just chart area as attached in screenshot (Trend_chart2)
Thanks. It solved both issues
Need your inputs on removing the border (bottom line) marked in attached screenshot (Trend_chart1). We need the border to just chart area as attached in screenshot (Trend_chart2)
- Attachments
-
- Trend_Chart2.png (178.36 KiB) Viewed 19393 times
-
- Trend_Chart1.png (32.48 KiB) Viewed 19393 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Bottom and Custom Vertical Axis Label Start Position
You're welcome, I'm very glad to hear it!Priyanka wrote: Thanks. It solved both issues
You can try:Priyanka wrote: Need your inputs on removing the border (bottom line) marked in attached screenshot (Trend_chart1). We need the border to just chart area as attached in screenshot (Trend_chart2)
Code: Select all
WebChart1.Chart.Panel.Bevel.Inner = BevelStyles.None;
WebChart1.Chart.Panel.Bevel.Outer = BevelStyles.None;
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Bottom and Custom Vertical Axis Label Start Position
Hi Christopher,
I tried it but no luck.
I tried it but no luck.