Page 1 of 1
Axis.PositionUnits constants
Posted: Mon Apr 03, 2006 9:56 am
by 9530384
Hi.
I need to set the StartPosition and EndPosition of a CustomAxis in Pixels. By default it is in percent. The documentation only lists the EPositionUnits with the constants puPercent and puPixels. But I CANT use the Enum constants because it isnt supported in my development environment. So I would need something like puPercent = 0, puPixels = 1.
I already tried 0 and 1 but the Unit always remains percent.
thanks for any help!
Posted: Mon Apr 03, 2006 10:09 am
by narcis
Hi AHIS,
As you can see in TeeChartDefines.h at C:\Program Files\Steema Software\TeeChart Pro v7 ActiveX Control\Examples\Visual C++ the constants are:
// EPositionUnits
const unsigned long puPercent = 0;
const unsigned long puPixels = 1;
If the problem persists, could you please send us an example we can run "as-is" to reproduce the problem here?
Thanks in advance.
Posted: Mon Apr 03, 2006 11:05 am
by 9530384
I dont think I can send you any example that runs 'as-is' because I have the TChart-OCX integrated in a Progress Programming Environment...
But I set the following things:
chTChartRowManager.TChart.AddSeries(0).
chTChartRowManager.TChart.Series(0).asLine.Pointer.VISIBLE = TRUE.
chTChartRowManager.TChart.Series(0).asLine.Pointer.HorizontalSize = 3.
chTChartRowManager.TChart.Series(0).asLine.Pointer.VerticalSize = 3.
chTChartRowManager.TChart.Series(0).ShowInLegend = TRUE.
chTChartRowManager.TChart.Series(0).TITLE = "myLine".
chTChartRowManager.TChart.Series(0).VerticalAxisCustom = chTChartRowManager.TChart.Axis.AddCustom(FALSE).
chTChartRowManager.TChart.Series(0).VerticalAxis = 3.
chTChartRowManager.TChart.Axis.Custom(0).MAXIMUM = 50.
chTChartRowManager.TChart.Axis.Custom(0).MINIMUM = 0.
chTChartRowManager.TChart.Axis.Custom(0).PositionUnits = 1.
chTChartRowManager.TChart.Axis.Custom(0).EndPosition = 85.
chTChartRowManager.TChart.Axis.Custom(0).StartPosition = 40.
chTChartRowManager.TChart.Axis.Custom(0).AUTOMATIC = FALSE.
chTChartRowManager.TChart.Axis.Custom(0).GridCentered = FALSE.
chTChartRowManager.TChart.Axis.Custom(0).Increment = 10.
chTChartRowManager.TChart.Axis.Custom(0).GridPen.VISIBLE = FALSE.
chTChartRowManager.TChart.Axis.Custom(0).MinorTicks.VISIBLE = FALSE.
chTChartRowManager.TChart.Axis.Custom(0).MinorGrid.VISIBLE = FALSE.
chTChartRowManager.TChart.Legend.VISIBLE = TRUE.
chTChartRowManager.TChart.Legend.ResizeChart = TRUE.
chTChartRowManager.TChart.Legend.CheckBoxes = TRUE.
chTChartRowManager.TChart.Legend.Alignment = 3.
chTChartRowManager.TChart.Legend.Series = 0.
The PositionUnits = 1 only seems to work with PositionPercent but not with Start/EndPosition!
Posted: Wed Apr 05, 2006 12:40 pm
by narcis
Hi AHIS,
PositionUnits is only to set PositionPercent units.
What you request can not be done directly. However, you can do it manually using a function like that:
Code: Select all
Private Function GetPercentageFromPixels(ByVal pixels As Double) As Double
Dim bmp As Bitmap = TChart1.Bitmap 'to recalculate chartrect
Dim rect As Rectangle = TChart1.Chart.ChartRect
Return pixels / (rect.Width / 100)
End Function
Posted: Thu Apr 13, 2006 8:29 am
by 9530384
Hi Narcis.
Now I have managed to position my axis correctly with Start/EndPosition. But there is the following problem:
For example I draw the axis from 25% to 75% with Minimum 0 and Maximum 100. The series itself is from type 'asLine'. If I add a point using AddXY with Y larger than Maximum the line is drawn outside the Start/EndPosition using the whole ChartCanvas! That is not what I want.
appreciate any help!
Posted: Thu Apr 13, 2006 8:47 am
by narcis
Hi AHIS,
Then you should do as in the Opaque zones example at TeeChart features demo. The example is at All Features\Welcome !\Axes.