Charting library

agraham

Expert
Licensed User
Longtime User
Can I change the Y position of the text of the X axis somehow change?
I'm fixing the font size under VGA which should fix this as well. You've probably noticed that under VGA font sizes are twice those under QVGA - I'm fixing that so Charts should render identically under VGA and QVGA.
 

Paulsche

Well-Known Member
Licensed User
Longtime User
I'm fixing the font size under VGA which should fix this as well. You've probably noticed that under VGA font sizes are twice those under QVGA - I'm fixing that so Charts should render identically under VGA and QVGA.

Thank you
 

Caravelle

Active Member
Licensed User
Longtime User
I've been playing with this library,

How is the size of the text which appears on the segments of the pie chart controlled?

In all the pie charts I've drawn the text comes out at about 1mm high on my VGA iPAQ with the image stretching from one side of the screen to the other and is totally illegible. But with the sample sbp it comes out just about legible - a bit bigger would still be helpful though! I really can't see anything different thta matters between your sbp and mine, apart from different image size, colours & number of segments.

Sorry to be a pest.

Thanks

Caravelle
 
Last edited:

agraham

Expert
Licensed User
Longtime User
How is the size of the text which appears on the segments of the pie chart controlled?
It is poportional to the height of the Chart. Having just looked at the source code I note that there is an undocumented property "scaleY" (there by a happy/unfortunate oversight/error on my part!) on each chart and the legend that will adjust the size of the font. After Newing the chart or legend you can try setting it to a different value, start at 10 and see how it looks. It may however upset the chart title size, you will have to see if that is acceptable to you.

EDIT:- There's some interaction with scaleY going on with some sizing logic that I haven't fully looked at. Setting scaleY to values less than 1 should scale both title and chart fonts, try say 0.85. Setting values much larger than 1 will set the font size directly so both title and chart font will be drawn the same size.
 
Last edited:

Caravelle

Active Member
Licensed User
Longtime User
Excellent. That works nicely, thank you. scaleY is just about legible at 5, with an image size of 450 x 420, scaleY of 7 to 10 is clearly legible. I wasn't using a legend anyway, I have coloured labels under the image which say what each segment of that colour represents and what the value is. This isn't a formal business presentation, it's just a quick visual aid as to how much space on my SD card the files on the CF card will take up when copied over. My pie-chart has gone from "nice colours, shame about the tiny white smudges" to "Pretty cool, huh?".

I know the answer is probably "impossible" owing to various limitations, but it would be nice to have full control over these little labels - size, colour, font and a short prefix or suffix with the numerical value, such as "£" or "kg". I won't hold my breath...

Thanks again. Most of my little project seems to be based on your dlls!

Caravelle
 

Caravelle

Active Member
Licensed User
Longtime User
Scale again

I'm a bit surprised to see no posts on the subject of the charts library since mine of last year. That must mean that everyone is happy with the way it works!

I got my program working fine and used it with some success in the Far East last year. I'm rather puzzled now by the fact that I have changed nothing but when I went to run it again from the sbp on the device, the screen size has changed to something much bigger and as it doesn't have any scrollbars I can't get to half the controls, but I guess that's something for another thread. I've also forgotten completely what B4PPC I had learned, it must be age.

Anyway, I tried to compile my program on the desktop, and re-discovered why I've been running it from the sbp on the device. I can't get the desktop to compile the device version of the program. It refuses to cooperate with "PieChart.ScaleY = 8", even though the device happily runs the sbp with that line it. Am I missing something obvious?

I have to fix these issues in time for a trip to the USA starting on 15 July.

Thanks

Caravelle
 

agraham

Expert
Licensed User
Longtime User
It would help if you gave some details of the problem, like the error message for example. I have no problem compiling that line for the device. I suspect that you are using ChartsDesktop as a desktop component, remove it and add ChartsDevice instead.
 

Caravelle

Active Member
Licensed User
Longtime User
I really cannot get my head around how B4PPC works. Surely in the desktop IDE I have to have both ChartsDesktop.dll and ChartsDevice.dll, on the desktop and device sides of the components list respectively - which I do, so that (a) the program can be tested and run on the desktop and (b) a version of the program for the device can be compiled when requested. That is how all the other library components work. Are you telling me to put ChartsDevice.dll on the desktop side of the components list as well as the device side?

The error message is "Invalid property: scaley".

This is the entire sub which contains the line that causes the error, a, b and c are the numbers which set the size of the pie-slices, L1, L2 and L3 are string variables which provide the text of labels around the chart:

B4X:
Sub ShowPie(a,L1,b,L2,c,L3)
  Label4.Visible=False
  Piechart.New1(Image1.Width, Image1.Height)
  Piechart.scaleY = 8
  Piechart.Color = cWhite
  Piechart.BorderSize = 5
  Piechart.AddSlice(a, Rgb (255,0,0))
  Piechart.AddSlice (b, Rgb (255,127,0))
  Piechart.AddSlice(c, Rgb (0,255,0))
  Image1.Image = Piechart.Draw
  Label1.Text = L1
  Label2.Text = L2
  Label3.Text = L3
End Sub

Thanks

Caravelle
 

agraham

Expert
Licensed User
Longtime User
Are you telling me to put ChartsDevice.dll on the desktop side of the components list as well as the device side?
Yes, remove ChartsDesktop and replace it with ChartsDevice. ChartsDevice is different to ChartsDesktop as it has scaling factors to cope with different resolution device screens. If you want to compile for the device you need ChartsDevice as the desktop component as that is what the compiler uses to generate the code.

Both ChartsDevice and ChartsDesktop will work on the desktop. I agree the naming is unfortunate but is historical. ChartsDesktop should now probably be called something different as although it was once compatible with ChartsDevice it no longer is. These libraries were written a while ago before AutoScaling. If I were starting again I would do them in a slightly different way.
 

Caravelle

Active Member
Licensed User
Longtime User
OK, thanks. I'll take your word for it! I tried it and it works, which is the main thing.

Cheers

Caravelle
 
Top