Chart widget and axes which are time values.

scott at elementarysoftware.com scott at elementarysoftware.com
Tue Feb 22 21:23:04 EST 2022


Alex, I’m replying off list because my ulterior motive is to ask you a question.

Argh.  I see, after re-reading your post, that my remarks are useless. 

I’ve been spending a bit of time trying to replace my old chartsEngine library with the new chart widget. I haven’t tried any of the commands that wrap JSON. So, ultimately I have no answer to your question. I’ve used the more simplistic COMMA delimited [ set the csvData of widget "Chart" to tCSVData ].  (The TAB delimited one seems to work also.)

One thing that sometimes made a difference about what displayed was using: [ set the lockChartUpdates of widget "Chart" to “true” ] before messing with the widget and then [ set the lockChartUpdates of widget "Chart" to “false” ] when I was done.

I suspect that you have tried this already but...

Using [ put "cats"&COMMA&"19"&CR&"dogs"&COMMA&"12"&&CR&"gerbils"&COMMA&"5"&&CR&"wombats"&COMMA&"9" into tCSVData ]  puts “cats, dogs, gerbils and wombats” along the X-axis for me.

I found that:  [ set the dataLabels of widget "Chart" to "Cats,Dogs,Gerbils,Wombats” ]  would also set the X-axis labels if it matched up with the number of data points.


My question for you, since you’ve been messing with the widget, is about setting the alpha / transparency of the chartBackgroundColor property. Only one time have I seen it work as expected from the property inspector and never have I been able to produce a transparent background by script. I was wondering if you had tried this property. (I posted about this in bugzilla and the mothership asked me to create a separate bug report because it worked fine for them… I don’t have a problem creating a bug report, it just seemed odd that it absolutely doesn’t work for me.)

--
Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web       https://elementarysoftware.com/
email     scott at elementarysoftware.com
booth    1-360-734-4701
mobile   1-360-920-0715
------------------------------------------------------




> On Feb 22, 2022, at 5:54 AM, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I've been trying to use the new chart widget, but no success yet.
> 
> All the charts I want to do have times (or dates) along the X axis.
> 
> I can see that any options which have not been wrapped in LC can be set by doing something like:
> 
>    put the chartJSONOptions of widget "mine" into tA
>    put "time" into tA["scales"]["x"]["type"]
>    set the chartJSONOptions of widget "mine" to tA
> 
> but this still gives me
> 
>     Error: This method is not implemented:
>     Check that a complete date adapter is provided.
> 
> 
> and I have no idea how to provide a date adapter from LC.
> 
> Has anyone else tried date/times with more success ?
> 
> (The chart.js documentation implies there is a default adapter - so nothing should need to be done. It also talks about installing JS libraries for other adapters - but I don't quite get it).
> 
> Thanks,
> 
> Alex.
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode









More information about the use-livecode mailing list