line graph widget > Help is welcome...

Ali Lloyd ali.lloyd at livecode.com
Wed May 18 09:46:45 EDT 2016


Hi Ton,

The graph widget layout code is rather complicated because of the
relationship between the available space for the graph and how much space
is needed for the axis labels. It is mainly for space saving reasons that
the drawYLabels handler does the following:

put the rounded of tNumber formatted as string into tString
Changing that to

put tNumber formatted as string into tString

will give you (too) accurate labels on your y-axis.

So what you also probably want to do is define a property (something like
yIncrement). There is already a variable mYIncrement which controls this
value, however this is currently calculated using the maximum value on the
y-axis (stored as mYMax) and
the number of points on the y-axis (mVPointCount). The latter is currently
set to the same as number of points on the x-axis in the calculateAll
handler.

-- Use the same number of points for the y-axis

put mHPointCount into mVPointCount

calculateMinMaxes()

-- Set the y axis point increment

put (mYMax - mYMin) / mVPointCount into mYIncrement

What you would need to do is tweak the logic so that mVPointCount is
calculated using the mYIncrement variable. This should be done after
calculateMinMaxes() is called so that the mYMax has already been
calculated. I *think* that apart from this (i.e.

calculateMinMaxes()

put (mYMax - mYMin) / mYIncrement into mVPointCount
)

you might also have to tweak mYMax and mVPointCount afterwards to make sure
the Y-axis maximum was high enough to accommodate a further increment, and
that mVPointCount was a whole number.

Ali

On Wed, May 18, 2016 at 1:36 PM Erik Beugelaar <ebeugelaar at gmail.com> wrote:

> Hi Ton,
>
> Pledge or Infinite LiveCode and this will all be low hanging fruit this
> summer ;-)
>
> Kind regards,
> Erik
>
> P.S. Just in case: this is a joke.
>
>
> Sent from solidit <http://www.solidit.nl/>
>
>
>
>
>
>
> On 18/05/16 14:28, "use-livecode on behalf of Ton Kuypers" <
> use-livecode-bounces at lists.runrev.com on behalf of
> tkuypers at publishingtools4u.com> wrote:
>
> >Just opened the .lcb file (thanks Peter), but this is not for average
> programmers like myself…
> >
> >Could anyone give me some pointers, or maybe modify the widget?
> >It would be great to set a sub-devision like .5, .2 or .1 so the axis
> don’t only show integers...
> >
> >
> >Met vriendelijke groeten,
> >Warm Regards,
> >
> >
> >
> >Ton Kuypers
> >+32 (0) 477 739 530
> >
> >Steenweg op Leopoldsburg 100 • B-2490 • Balen • Belgium
> >www.publishingtools4u.com
> >
> >
> >
> >
> >
> >> On 18 mei 2016, at 14:10, Peter TB Brett <peter.brett at livecode.com>
> wrote:
> >>
> >> On 18/05/2016 13:05, Ton Kuypers wrote:
> >>> Is it possible to change the scale of the axes of this widget?
> >>>
> >>> It works fine, but when the values contain decimals, the axis only
> shows integers, so 5,6,6.3,6.4,6.9,7,8 will show up as 5,6,6,6,6,7,8
> >>> Would be great to set a sub-devision like .5 or .1
> >>>
> >>> I tried editing the source like Kevin showed during his introduction
> video, but “module.lcm” is scrambled when you open it in Atom :-(
> >>
> >> You need to edit the ".lcb" file.   The ".lcm" file is the output of
> compiling the ".lcb" file with the lc-compile tool.
> >>
> >>                                               Peter
> >>
> >> --
> >> Dr Peter Brett <peter.brett at livecode.com>
> >> LiveCode Open Source Team
> >>
> >> LiveCode 2016 Conference: https://livecode.com/edinburgh-2016/
> >>
> >> _______________________________________________
> >> 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
> >
> >_______________________________________________
> >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
>
>
> _______________________________________________
> 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