Page 1 of 3
LineGraph Widget
Posted: Tue Jun 14, 2016 2:02 pm
by Zapan
Hello
As a little project I'm building a little Stock app.
For that purpose I employ the LiveCode linegraph widget.
Is there a Way to set the Numberformat of the Y-Axis of the Linegraph? Right now the Y-Axis only displays whole numbers, which for a Stock is pretty useless. I'd like it to Show "#.00" Numberformat.
I'm very thankfull for every help.
Best regards
Zapan
Re: LineGraph Widget
Posted: Wed Jun 15, 2016 12:46 pm
by Klaus
Hi Zapan,
1. welcome to the forum!
2. Since this is a widget, I'm afraid this is not possible.
Best
Klaus
Re: LineGraph Widget
Posted: Wed Jun 15, 2016 6:28 pm
by Zapan
Hello Klaus
Thank you very much
I feared as much.
Do you know a function (or maybe have a function laying arroung, I'm sorry for asking this bluntly) that will make a variable that has csv values in it into a nice stock graph, analog the Line graph widget but with the numberformat #.00 on the Y-Axis?
Best Regards
Zapan
Re: LineGraph Widget
Posted: Wed Jun 15, 2016 6:52 pm
by FourthWorld
Maybe easier to fork the widget source from Github to make the relatively small change you need.
Re: LineGraph Widget
Posted: Thu Jun 16, 2016 3:49 pm
by bn
Hi Zapan,
here is a modded version of the lineGraph widget. It lets you choose the number of decimals to show.
unzip the file and put the folder into folder -> Documents -> myLivecode -> Extensions and restart Livecode.
It will now be installed as a second LineGraph in the tools section, the name is "Line GraphBN"
look at the Properties inspector and the dictionary -> API -> Line GraphBN.
setting the decimalFormat to 0 shows just integers, the default behavior. Setting the decimalFormat to a number greater zero show x decimals.
To uninstall this widget use the -> Tools Menu -> Extension Manager. Or remove the folder from your "Extensions" folder in MyLivecode.
If you do play with this I would be interested how it works for you.
Kind regards
Bernd
Edit: I deleted the version that used to be here and have posted a newer version further down
http://forums.livecode.com/viewtopic.ph ... 15#p145912
Re: LineGraph Widget
Posted: Thu Jun 16, 2016 3:51 pm
by Klaus
Waaaaaaay cool, Bernd, thanks a lot!

Re: LineGraph Widget
Posted: Thu Jun 16, 2016 4:01 pm
by bn
Klaus wrote:Waaaaaaay cool, Bernd, thanks a lot!

You are welcome, Klaus

What would be a life without decimals?

I could not even track my penny stocks
Kind regards
Bernd
Re: LineGraph Widget
Posted: Thu Jun 16, 2016 4:09 pm
by Klaus
bn wrote:What would be a life without decimals?
I don't have the slightest idea!

Re: LineGraph Widget
Posted: Thu Jun 16, 2016 6:57 pm
by FourthWorld
That's a great enhancement, Bernd. It may be worth considering submitting that as a pull request so it can become part of the master build.
Re: LineGraph Widget
Posted: Thu Jun 16, 2016 10:04 pm
by bn
Hi Richard,
thanks, I am planning to submit this as a pull-request. I just wanted to wait for a little feedback, just in case...
But the code is ready for a pull-request, including inline-documentation and addition to the Properties Inspector.
Adding a property to the Properties Inspector is extremely versatile and easy. Ali Lloyd did a marvelous job with the Properties Inspector and the new IDE.
Kind regards
Bernd
Re: LineGraph Widget
Posted: Fri Jun 17, 2016 12:10 am
by FourthWorld
bn wrote:thanks, I am planning to submit this as a pull-request. I just wanted to wait for a little feedback, just in case...
Thanks, Bernd. Your efforts are much appreciated.
Re: LineGraph Widget
Posted: Fri Jun 17, 2016 9:40 am
by bn
Pull request here:
https://github.com/livecode/livecode/pull/4174
this version compared to the posted version has an additional left margin for Y-labels and limits to maximum of digits for decimals to 5
Kind regards
Bernd
Re: LineGraph Widget
Posted: Tue Jun 21, 2016 8:03 am
by Zapan
Hello Everyone
I'm Sorry for my late reply, lifes busy as it seems...
Thank you very much BN!!! You just made my Life massively easier...! You're a lifesaver.
Works like a charm.
Thanks everyone for your reply and your Help!
Zapan
Re: LineGraph Widget
Posted: Sun Jul 17, 2016 9:43 am
by bn
Hi,
when discussing the pull request
https://github.com/livecode/livecode/pull/4174
it turned out that the Livecode team prefers a more generalized version of the valueToString / numberFormat / decimal problem. That should go into a module that is available to all widgets.
I think that is perfectly reasonable and I closed the pull request.
For those who compiled & installed the LCB script I posted above please note that as of LC 8.1.0 DP2 the widget format changed slightly and widgets compiled with earlier versions need to be recompiled with the newer LC version.
Kind regards
Bernd
Re: LineGraph Widget
Posted: Sun Aug 21, 2016 7:11 pm
by francof
Hi all,
I 've tried to use the widget Line GraphBN, my LC vers. is 8.0.1
unzipped the file into folder -> Documents -> myLivecode -> Extensions and restarted Livecode, but I can't see the new line graph into the tools palette.
into extentions folder I 've the "com.livecode.widget.lineGraphBN.1.0.2" folder
something wrong?
thanks franco