chartsEnginge and Histogramm

Malte Pfaff-Brill revolution at derbrill.de
Sat Sep 26 11:09:10 EDT 2009


Hi Till,

excuse me, I am a bit weekend sleepy it seems.

here is what happens (or what I suppose what happens):

I suppose you do not tell chartsEngine what the x-axis of the chart  
should be, so it tries to figure out the minimum and maximum x and  
thus sorts the data. (that it does it *alphabetically* instead of  
numeric indeed seems to be a bug I´ll look into tonight)

However here is a solution. Include an x in your data:

example script:

on mouseUp pMouseBtnNo
     local tChart,tData
     start using chartsEngine
     chartsCreateChart "test"
     put the result into tChart
     put empty into tData
     repeat with i=1 to 20
         put i,i&cr after tData-- item 1 will be used as the x-axis
     end repeat
     set the charts["dataIncludesX"] of tChart to true
     set the charts["data"] of tChart to tData
     set the charts["chartStyle"] of tChart to "barsGrouped"
     chartsRefresh tChart
end mouseUp

or for the multicolored version try this:

on mouseUp pMouseBtnNo
     local tChart,tData
     start using chartsEngine
     chartsCreateChart "test"
     put the result into tChart
     put "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20" into tData
     set the charts["dataIncludesX"] of tChart to false
     set the charts["data"] of tChart to tData
     set the charts["chartStyle"] of tChart to "barsGrouped"
     chartsRefresh tChart
end mouseUp

Hope that helps to get you started.

Malte


More information about the use-livecode mailing list