Jump to content
Software FX Community

Problems labelling and scaling x- and y-axes

User (Legacy)

Recommended Posts

Hi there,

I have some problems with labels and scales for my charts. To depict the

problems I attached a bitmap of a chart and some code snippets.

1. I succeeded in labelling my x-axis the way I wanted but the last tick

doesn't show any label no matter what max-value (or none) I set.

2. I also succeeded in labelling my y-axis but I can't achieve minor ticks

here although I did it the same way as for the x-axis.

I can't turn off autoscaling for the y-axis because then ChartFX takes

the highest value of all available series in the resultset although I told

the control to neglect these series (e.g. cfx.DataType(2)=CDT_NOTUSED) and

I don't want to search for the highest value of the representative series

(DataType(1) here) in my resultset.

3. I formatted the tooltip according to my needs but it looks very ugly

when it shows "22,00 out of 179,00 (12,29 %)".

I'd prefer "22 out of 179 (12,29 %)" but if I try to use the Format or

Decimal properties the result is: "22 out of 179 (12 %)". That's also why

I use the GetAxisLabel method to format the labels as using the format

property for the y-axis also reflects this format in the tooltip.

For further details please have a look on the attached bitmap and the

following code snippets.

Any help will be greatly appreciated.

Thanks in advance.


******************* Code snippets follow below *************************

Private Sub InitChart()


CfxData.ResultSet = MyRs

With cfx

.Gallery = BAR

.Chart3D = False

With .Axis(AXIS_X)

.Title = "Uhrzeit"

.Style = .Style Or AS_NOTIFY

.Min = 0.5

.TickMark = TS_OUTSIDE

.STEP = 4

.MinorStep = 1

End With

With .Axis(AXIS_Y)

.Title = "Anzahl Ereignisse"

.Style = .Style Or AS_NOTIFY

.TickMark = TS_INSIDE

.MinorStep = 1

End With

.DataType(0) = CDT_LABEL

.DataType(1) = CDT_VALUE

.DataType(2) = CDT_NOTUSED

.DataType(3) = CDT_NOTUSED

.GetExternalData CfxData

'Tooltip-Maske: Anzahl: x von y (z %)

.TipMask = "%s" + ": " + "%v" + " von " + "%t" + _

" (" + "%p" + " %%)"

End With


End Sub

Private Sub cfx_GetAxisLabel(ByVal nAxis As Integer, nRes As Integer)


Select Case nAxis

Case AXIS_X 'show the time as 12:00

cfx.HText = cfx.HText & ":00"

Case AXIS_Y 'ommit the decimals in the label

cfx.HText = Format(cfx.HText, "###")

End Select

nRes = 1


End Sub

Private Sub cfx_GetTip(ByVal nHit As Integer, ByVal nSerie As Integer,

ByVal nPoint As Long, nRes As Integer)

Select Case (nHit)


'no action

Case Else

cfx.HText = ""

End Select

nRes = 1

End Sub


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...