I created 2 custom axis assigned a series to each. I set the Units to Pixels and what I am finding is the start and end position is picking up pixels not percent. I assume by the labels that position should be the only property that is associate with pixels.
Thanks
Custom Axis Pixels
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello!
The Steema.TeeChart.Axis.PositionUnits property will effect the units of all calculations to do with the positioning of axes on the chart. If you want to still work with percentages when you have selected pixels, you can 'manually' convert one to the other as in the example below:
The Steema.TeeChart.Axis.PositionUnits property will effect the units of all calculations to do with the positioning of axes on the chart. If you want to still work with percentages when you have selected pixels, you can 'manually' convert one to the other as in the example below:
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line1;
Steema.TeeChart.Styles.Line line2;
Steema.TeeChart.Axis custom1;
Steema.TeeChart.Axis custom2;
tChart1.Aspect.View3D = false;
tChart1.Panel.MarginLeft = 10;
tChart1.Panel.MarginRight = 10;
tChart1.Legend.Visible = false;
tChart1.Series.Add(line1 = new Steema.TeeChart.Styles.Line());
tChart1.Series.Add(line2 = new Steema.TeeChart.Styles.Line());
tChart1.Axes.Custom.Add(custom1 = new Steema.TeeChart.Axis());
tChart1.Axes.Custom.Add(custom2 = new Steema.TeeChart.Axis());
custom1.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
custom2.PositionUnits = Steema.TeeChart.PositionUnits.Pixels;
line1.CustomVertAxis = custom1;
custom2.OtherSide = true;
line2.CustomVertAxis = custom2;
line1.FillSampleValues();
line2.FillSampleValues();
Bitmap bmp = tChart1.Bitmap; //redraw chart to extract chartrect
Rectangle rect = tChart1.Chart.ChartRect;
custom1.StartPosition = ConvertPixelToPercent(rect.Height, 50);
custom2.StartPosition = ConvertPixelToPercent(rect.Height, 50);
custom1.EndPosition = ConvertPixelToPercent(rect.Height, 100);
custom2.EndPosition = ConvertPixelToPercent(rect.Height, 100);
}
private int ConvertPixelToPercent(int ChartHeight, int PercentPos)
{
double result = ChartHeight / 100.0;
result *= PercentPos;
return Steema.TeeChart.Utils.Round(result);
}
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
Would you be so kind as to modify my example above so that I can reproduce your issue?
Many thanks!
Would you be so kind as to modify my example above so that I can reproduce your issue?
Many thanks!
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello!
Got it! OK, I can reproduce this and have fixed it for the next maintenance release.
Got it! OK, I can reproduce this and have fixed it for the next maintenance release.
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/