Jump to content
Software FX Community

Re: Problems labelling and scaling x- and y-axes


User (Legacy)

Recommended Posts

Bernd,

I have expanded the axis to view the last label:

ChartFX.Axis(Axis_X).Max = ChartName.Axis(Axis_X).Max * 1.1

also have used the ShowEnds:

ChartFX1.Axis(AXIS_Y).Style = ChartFX1.Axis(AXIS_Y).Style Or AS_SHOWENDS

Turn on your MinorStep as well as MinorTickMark:

ChartFX.Axis(AXIS_Y).MinorStep = 1

ChartFX.Axis(AXIS_Y).MinorTickMark = TS_INSIDE

Haven't played much with TipMask but with:

'turn chart on

Me.ChartFX1.TypeMask = Me.ChartFX1.TypeMask Or CT_TRACKMOUSE

have used the following:

Private Sub ChartFX1_LButtonDown(ByVal x As Integer, ByVal y As Integer, nRes As Integer)

Dim dblX As Double

Dim dblY As Double

Me.ChartFX1.PixelToValue x, y, dblX, dblY, AXIS_Y

Me.ChartFX1.ControlTipText = x & "," & y & " " & Format(dblX, "##.##") & "," & Format(dblY, "##.##")

End Sub

Steve

Bernd Hoffmann <Bernd.Hoffmann@insocam.de> wrote in message news:3A1BC1B4.E907B210@insocam.de...

> 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.

>

> Bernd

>

> ******************* 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)

> Case HIT_POINT

> 'no action

>

> Case Else

> cfx.HText = ""

>

> End Select

> nRes = 1

>

> End Sub

--------------------------------------------------------------------------------

weekly.BMP

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...