Page 1 of 1

IAxisLabels.Exponent Odd or ?

Posted: Fri Sep 25, 2009 1:02 am
by 15047219
I tried using the "IAxisLabels.Exponent" set to TRUE to get exponent super scripts using the ValueFormat of "00e-0".

It looks real nice, but the tick labels are wrong. When I plot linear the ticks line up with my data just right. The when I change to a log scale and this formating the values displayed are "10 with superscript of 0" for the 100s tick, for the 1000s I get "10 with a superscript of 1"

I've upload an image

Re: IAxisLabels.Exponent Odd or ?

Posted: Fri Sep 25, 2009 4:05 pm
by narcis
Hi jfrancis,

I don't think axis labels are wrong. It's just that they are set in a logarithmic scale now and therefore they are not on the same position as in al linear scale. Try using the code below commenting in and out the ValueFormat line and you'll see how axis change with logarithmic scales.

Code: Select all

    TChart1.Aspect.View3D = False
    
    TChart1.AddSeries scFastLine
    TChart1.Series(0).FillSampleValues 10000
    
    TChart1.Axis.Bottom.Labels.ValueFormat = "00e-0"
    TChart1.Axis.Bottom.Logarithmic = True
Hope this helps!

Re: IAxisLabels.Exponent Odd or ?

Posted: Mon Sep 28, 2009 4:32 pm
by 15047219
Sorry I was not clear.

What the two plots show the same data with an x-axis linear (bottom image) and then plotting the x-axis using log scale (top image).

The left three data points plot at "10" in linear and 10^0 ( which is 1 ) in log. I think it should of been 10^1

The middle three data points plot at "100" in linear and 10^1 ( which is 10 ) in log. I think it should of been 10^2

The right four points plot at "200" in linear and the 10^1.1 ( which is ~12.59 ) in log. I think it should of been 10^2.3

Note: I used ^ to show 10 raised to the power of.

I hope this clears up my concern.

Re: IAxisLabels.Exponent Odd or ?

Posted: Tue Sep 29, 2009 12:05 pm
by yeray
Hi jfrancis,

If I understood well, you could solve it using OnGetAxisLabel event:

Code: Select all

Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
  If Axis = 3 Then
    LabelText = Format(Val(LabelText) * 10, "00e-0")
  End If
End Sub

Re: IAxisLabels.Exponent Odd or ?

Posted: Tue Oct 06, 2009 3:49 pm
by 15047219
Yes,

I could solve the problem by doing the coding and handling the event myself.

Basically I'm saying is that your charting library is in ERROR and are you going to fix it?

Thanks,
John Francis

PS: I'm coding in C++ and MFC.

Re: IAxisLabels.Exponent Odd or ?

Posted: Wed Oct 07, 2009 8:56 am
by yeray
Hi John Francis,

Yes, I've added this to the wish list to be fixed in future releases (TV52014469).

Re: IAxisLabels.Exponent Odd or ?

Posted: Wed Oct 07, 2009 4:24 pm
by 15047219
Thanks, can you update when the fix is included?

Re: IAxisLabels.Exponent Odd or ?

Posted: Thu Oct 08, 2009 7:35 am
by yeray
Hi jfrancis,

I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's implemented on them.

Re: IAxisLabels.Exponent Odd or ?

Posted: Sat Nov 14, 2009 2:25 am
by 5890703
Please point me to sample code for formatting exponents and subscripts when in the TextOut() method.

Re: IAxisLabels.Exponent Odd or ?

Posted: Mon Nov 16, 2009 12:33 pm
by yeray
Hi Hans,

Have you tried simply changing the font size? For example:

Code: Select all

Private Sub Form_Load() 
  TChart1.Aspect.View3D = False
  TChart1.AddSeries scBar
  
  TChart1.Series(0).FillSampleValues 6
End Sub

Private Sub TChart1_OnAfterDraw()
  Dim TextWidth As Integer
  Dim Text As String
  Text = "2 x 5"
  TextWidth = TChart1.Canvas.TextWidth(Text)
  TChart1.Canvas.TextOut 100, 100, Text
  TChart1.Canvas.Font.Size = 4
  TChart1.Canvas.TextOut 100 + TextWidth, 100, "10"
End Sub