Anyone using rhcharts?

Hi. I was in need of including charting into my app and came across this post in the former RS forums:
http://forums.realsoftware.com/viewtopic.php?f=1&t=45240

I’ve been using this, and it’s awesome! However, I wanted to include the values on the bar charts as seen on page 3 of this post, but the links to DropBox seem to have been disabled. Has anyone used these charts and made your own updates to it?

https://github.com/richhatfield/rhCharts

Thanks Norman. I have been going by his v1.3.1, but I see that others have added to the project to include the values on the bar graphs. Do you know how to do this? The DropBox files from languer for v1.3.1b are not valid anymore

[quote=45395:@Ryan Hartz]Thanks Norman. I have been going by his v1.3.1, but I see that others have added to the project to include the values on the bar graphs. Do you know how to do this? The DropBox files from languer for v1.3.1b are not valid anymore
[/quote]
I’ll see what I can do to get the dropbox link working, but more importantly I’ll try to get it into github. I may need some help though.

I don’t as I’ve never used this in any projects - I just found the git repository

I have used rhcharts but it was a long time ago. pre-numbers on the bar. luckily the client didnt want the numbers so it wasnt an issue.

Updated link for RBO file: https://dl.dropboxusercontent.com/u/42062295/RealSoftware/my%20rhChart_1-3-1.rbo

Updated link for example project: https://dl.dropboxusercontent.com/u/42062295/RealSoftware/my%20rhChart_1-3-1%20Example.rbp

Refreshed a few times but still not able to “edit”, so be it.

I need to understand how to get the files in the github still.

EDIT: Funny, on this second post the “edit” icon showed up immediately. Oh well.

Thank you L!! Would you know how to format the bar values? I wanted to format to dollar signs. I am thinking it would go in the drawChart method here

pic.Graphics.DrawString(str(dataItem(barCount)),labelX, labelY,0,True)

I attempted making a dataItemstr() as string and barCountstr as string, but am getting an error that this is expecting Int32 and not string. Any ideas? Here’s what I tried

If labelPosition > 0 Then // x-position, compensate for label width labelX = bar.X labelX = labelX - ( Str(dataItem(barCount)).Len / 0.5 ) // y-position If labelPosition > 1 Then labelY = bar.Y + (barHeight / 2) pic.Graphics.ForeColor = &c000000 pic.Graphics.Bold = True barCountstr = Format(barCount, "\\$###,###,##0.00") Else labelY = bar.Y labelY = labelY + 6 // compensate for label height pic.Graphics.ForeColor = &cFFFFFF End If pic.Graphics.DrawString(str(dataItemstr(barCountstr)),labelX, labelY,0,True) End If

You could replace

pic.Graphics.DrawString(Str(dataItem(barCount)),labelX, labelY,0,True)

with

pic.Graphics.DrawString(Str(dataItem(barCount),"\\$#.00"),labelX, labelY,0,True)

or

pic.Graphics.DrawString(Format(dataItem(barCount),"\\$#.00"),labelX, labelY,0,True)

Not the elegant way, but should get you going.

That’s perfect! Thank you L!

Would scaling of the graph/canvas after it has been drawn much of a problem?

This is very impressive chart class. But I’m novice to Xojo stuff.
I’m able to change label color, dynamically change scale of the chart , but I have problem with background. I would love to change white to different color
Does anyone know how to change background colour of the chart/canvas I can’t figure it out by myself ?

[quote=83431:@piotr dabrowski]This is very impressive chart class. But I’m novice to Xojo stuff.
I’m able to change label color, dynamically change scale of the chart , but I have problem with background. I would love to change white to different color
Does anyone know how to change background colour of the chart/canvas I can’t figure it out by myself ?[/quote]

Hi Piotr,

I am happy to hear that you find the charting class helpful :slight_smile:

Initially when I created it, I did not have background color in mind… but I do now :slight_smile: I just updated the github version to 1.3.2 to accommodate your request rhCharts .

you would add background color like line column chart 2 example:

[code] ’ Chart Width, Chart Height, Chart Title, Minimum Scale, Maximium Scale, Number Of Gridlines, Label Spacing, Data Item Array, Data Label Array, Data Color Array, Text Orientation, GridStyle, Background Color

displayCanvas.Backdrop = chart.chartColumn(displayCanvas.Width, displayCanvas.Height,“Column Chart 2”, 0, 200, 10, dataItem, dataLabel, dataLegend, dataColor, 0, 1, &cFFFF99)[/code]

Thanks Rich - ‘You Are The Man’

I have used “pic.Transparent=1” in chartColumn" event but it is not that I wanted.

I find this project/class very useful as tutorial too. One can learn a lot from it.
I must say that I admire people like you to contribute to Xojo in this way.
Once more thank you for your time and effort. I hope some day I would be able to contribute with such project/class too.

[quote=83559:@piotr dabrowski]Thanks Rich - ‘You Are The Man’

I have used “pic.Transparent=1” in chartColumn" event but it is not that I wanted.

I find this project/class very useful as tutorial too. One can learn a lot from it.
I must say that I admire people like you to contribute to Xojo in this way.
Once more thank you for your time and effort. I hope some day I would be able to contribute with such project/class too.[/quote]

Thank you for your kind words :slight_smile:

The Xojo community is a fantastic one and I too found I learned best by looking at example projects and reading the forums. My charting class started out as a proof of concept of how I could work with drawing graphics to a canvas which translated into me wanting to share it with the community as a thank you to all the help I received along the way.

My goal in the future is to add more charts to the class; however, I have found that two small children have there way of planning my day :stuck_out_tongue:

Kids are simple. Just wait until your parents need help. Think BIG children with a long history of telling you what to do - not the other way around :slight_smile:

Hello everybody, I’m trying the version 1.3.2 and works awesome, thank you very much Rich for share it, I prefer the bars without border line, that’s no problem, but I would like change a few things too, like to show the value of each bar like Ryan say above but I can’t find where to do that, one different color for each column (b.e. like when you show a poll result, different results for the same question) and finally to make the bars a little bit slim and more separated from each other, I hope some one could help me with this, have a nice day, thank you…

Well, for make the columns a little bit slim and more separated each other, I just changed this at drawColumn method:

barWidth = (((picWidth - yStartPosition - yEndPosition - 50) / (dataLabel.Ubound+1)))

to this:

barWidth = (((picWidth - yStartPosition - yEndPosition - 50) / (dataLabel.Ubound+1))) / 2

I think I’ll do that using a variable later, while I’ll keep trying and I’ll post any progress…