ChartKit

SuperCard 4.5 & 4.6 projects (.zip archives only please).

ChartKit

Postby sctell » Fri May 20, 2011 6:07 am

Hi,

Here is a sample project called ChartKit.

It is 100% SuperScript and includes 3 cards at the moment containing:

1. Pie Chart
2. Bar Chart
3. Line Chart

The script for producing each chart is contained within each card script.

Each chart has a number of user props and they are attached to the card.

Each card has 3 buttons.

1. Set Chart Properties -- sets properties of the chart
2. Draw ... Chart -- draws the chart to the card
3. Print Preview Chart -- prints the chart to preview

Each chart script keeps a list of the objects created in forming the chart to allow deletion when redrawing without affecting anything else on the card.

Use the scripts as you will or suggest improvements and I will consider adding them for the benefit of all.

I am particularly interested in speeding up the pie chart.

On my machine the bar and line charts draw in about 8 ticks (probably fast enough)
The pie chart takes about 24 ticks. (not slow but could do with improving)

I think the pie chart speed is as a result of the following:
Code: Select all
choose draw arc tool
set the fillFore to tColor
drag from x + tXLoc,y - tRadius + tYLoc to x + tXLoc + tRadius,y + tYLoc


I am not sure of any other way to do this but suggestions are welcome.

The text to all charts prints out clearly and their are no jaggies as SC must use more modern print routines than it does drawing to screen routines.

Also there is no way to rotate text and have it print clearly within SC (it is always fuzzy) so I have adopted Scotts suggestion of vertical text and I have been trying to avoid using any externals at all.

If anyone knows an answer to the fuzzy rotated text issue then I will implement it even if it is an external.



ChartKit.sc45.zip
(13.83 KiB) Downloaded 188 times
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: ChartKit

Postby gonetriadrr » Tue May 24, 2011 4:40 pm

sctell wrote:I think the pie chart speed is as a result of the following:
Code: Select all
choose draw arc tool
set the fillFore to tColor
drag from x + tXLoc,y - tRadius + tYLoc to x + tXLoc + tRadius,y + tYLoc


I am not sure of any other way to do this but suggestions are welcome.


You might try maintaining an arc graphic as a clone source, and simply clone the source object to the destination and set properties.
This is how all objects are created in the 'BezierPen' project were source objects stored out of view in the main palette window. Don't know if this method is faster.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm


Return to Sample & Demo Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron