Page 1 of 1

[Solved] Bar Charts

Posted: Fri Feb 13, 2015 3:12 pm
by ThomasFireheart
I need to create a bar chart on a card.
BarChart.png
BarChart.png (12.89 KiB) Viewed 10035 times
Does anyone know if you can create something very close to the above in Livecode ? I've looked at both ChartEngine and ChartMaker and they both seem to not be able to create this bar chart - please correct me if I am wrong.

Is the best option to create a browser object and then 'render' a webpage that contains Chart.js ( http://www.chartjs.org/docs/#bar-chart ) to actually create the bar graph ? Bloating the resulting application executable by including the 'Chromium Embedded Framework' seems a bit much for what looks like a simple bar graph.

Re: Bar Charts

Posted: Fri Feb 13, 2015 5:01 pm
by dunbarx
Hi.

The old fashioned way is to lay out a string of controls, these could be buttons or rectangular graphics, say, and set the height property of each as required. There are a million blending and color possibilities. Do you see how this could work?

Craig Newman

Re: Bar Charts

Posted: Fri Feb 13, 2015 5:47 pm
by FLCo
ChartMaker supports gradient fills like this...

Image

which seems to approximate to what you are looking for. Data labels can be placed externally or internally, and you can choose your own color scheme.

http://www.flexiblelearning.com/chartmaker

Hugh Senior
FLCo

Re: Bar Charts

Posted: Fri Feb 13, 2015 6:42 pm
by ThomasFireheart
FLCo wrote:ChartMaker supports gradient fills like this...
Hugh,

What would be the code to create that chart ? I messed around with the demo of ChartMaker but couldn't get it to do anything like what you showed which was why I was thinking the only option was using the embedded browser.

Re: Bar Charts

Posted: Fri Feb 13, 2015 8:40 pm
by FLCo
Use the "Charts" dropdown menu, select "Samples" and choose "Single Series".

The display texture options are in the "Font & Color" section. Changing any option then clicking "Build chart" allows you to try out different settings.

Select the "Show syntax" checkbox for the required code to build the chart you have designed.

To see more detailed information, click the "How To" button for the full documentation including examples of every available setting, including those that are not available in the Utility.

Hugh Senior
FLCo

Re: Bar Charts

Posted: Sun Feb 15, 2015 9:44 pm
by charms
As you've asked how to do it from scratch...

If you want to do it from scratch you could do following:
* Create a rectangle for the background
* Create rects, one for each bar
* Align the rects on the background rectangle

Here how I would try to do it if I'd have to do it from scratch (please note that this is no working code. You'll have to investigate for yourself a little). Just as idea and starting point.

Code: Select all

set the style of the  templategraphic to "rectangle"

create graphic 
set the name of last graphic to "background"

create graphic
set the name of last graphic to "bar1"

create graphic
set the name of last graphic to "bar2"

set the width of graphic "background" to 200
set the height of graphic "background" to 200
set the left of graphic "background" to 10
set the top of graphic "background" to 10

set the height of graphic "bar1" to 100
set the width of graphic "bar1" to 20

set the height of graphic "bar2" to 100
set the width of graphic "bar2" to 20

set the bottom of graphic "bar1" to the bottom of graphic "background"
set the left of graphic "bar1" to the left of graphic "background"

set the bottom of graphic "bar2" to the bottom of graphic "background"
set the left of graphic "bar2" to the right of graphic "bar1" + 10
Using a tool like Chartmaker will of course come in handy if you need to do many complex different charts.

Kind regards,
Chris

Re: Bar Charts

Posted: Sun Feb 15, 2015 10:32 pm
by ThomasFireheart
charms wrote:Using a tool like Chartmaker will of course come in handy if you need to do many complex different charts.
To followup, I went ahead and purchased ChartMaker a day or so ago and have three bug/support requests submitted. Will post followup once I can create my 'simple bar chart'.

Re: Bar Charts

Posted: Sun Feb 15, 2015 10:42 pm
by FLCo
ChartMaker is scheduled for an update to Build 63 in the next day or so that is compatible with LC6.7x and 7x. There have been various engine issues that have prevented an update release until now.

Best regards

Hugh Senior
FLCo

Re: Bar Charts

Posted: Mon Feb 16, 2015 7:48 pm
by FLCo
ChartMaker 3
Build: 63
Release type: Update
Issued: 16 Feb 2015


This is a free maintenance update for LC6.7 and LC7 compatibility.
ChartMaker now requires LiveCode 5.5 or later. Earlier versions are not supported.

Full release notes and the new release download are available here, including a free 30-day trial (or use your existing key to update):
http://www.flexiblelearning.com/chartma ... atsnew.htm

The download is also available from https://livecode.com/store/marketplace/chartmaker/

Full announcement details are also posted here: http://forums.livecode.com/viewtopic.php?f=4&t=23225

Note that as a professional product, ChartMaker requires LiveCode Commercial. However, specific circumstances will be considered for developers who require unlocked maintenance access for their clients.


Hugh Senior
FLCo

Re: Bar Charts

Posted: Wed Feb 18, 2015 3:51 am
by ThomasFireheart
Just wanted to mention that with Build #64 of ChartMaker I am now able to create the Bar Charts that I wanted. Much thanks goes out to Hugh for quick bug fixes and speedy email replies. If anyone is considering including charts in their Livecode app, I'd definitely recommend ChartMaker.