LineGraph Widget

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Zapan
Posts: 3
Joined: Tue Jun 14, 2016 1:59 pm

LineGraph Widget

Post 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
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: LineGraph Widget

Post by Klaus »

Hi Zapan,

1. welcome to the forum! :D

2. Since this is a widget, I'm afraid this is not possible.


Best

Klaus
Zapan
Posts: 3
Joined: Tue Jun 14, 2016 1:59 pm

Re: LineGraph Widget

Post 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
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: LineGraph Widget

Post by FourthWorld »

Maybe easier to fork the widget source from Github to make the relatively small change you need.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: LineGraph Widget

Post 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
Last edited by bn on Thu Sep 01, 2016 7:43 pm, edited 1 time in total.
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: LineGraph Widget

Post by Klaus »

Waaaaaaay cool, Bernd, thanks a lot! :D
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: LineGraph Widget

Post by bn »

Klaus wrote:Waaaaaaay cool, Bernd, thanks a lot! :D
You are welcome, Klaus :)
What would be a life without decimals? ;-) I could not even track my penny stocks :(

Kind regards
Bernd
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: LineGraph Widget

Post by Klaus »

bn wrote:What would be a life without decimals?
I don't have the slightest idea! :D
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: LineGraph Widget

Post 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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: LineGraph Widget

Post 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
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: LineGraph Widget

Post 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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: LineGraph Widget

Post 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
Zapan
Posts: 3
Joined: Tue Jun 14, 2016 1:59 pm

Re: LineGraph Widget

Post 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. :D
Works like a charm.

Thanks everyone for your reply and your Help!
Zapan
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: LineGraph Widget

Post 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
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: LineGraph Widget

Post 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
Post Reply