Malte
I am a little lazy, therefore I ask before trying out myself: Is there an easy way to print the charts? Printing your examples shows only a part of the chart an I did not see how to choose landscape in the predefined dialog.
Till
Printing
Moderators: heatherlaine, BvG
Hi Till,
chartsEngine is optimized for screen display, however, that does not mean one can not print them. Just that some scripting/layout work needs to be done to print charts. Maybe a format chart for printing option would be a way to go. In the meantime, set up a stack in the desired printing dimensions and create a chart that fills the card. After that answer printer and print the card. If you want I could whip up a demo to do that.
Cheers,
Malte
chartsEngine is optimized for screen display, however, that does not mean one can not print them. Just that some scripting/layout work needs to be done to print charts. Maybe a format chart for printing option would be a way to go. In the meantime, set up a stack in the desired printing dimensions and create a chart that fills the card. After that answer printer and print the card. If you want I could whip up a demo to do that.
Cheers,
Malte
-
- VIP Livecode Opensource Backer
- Posts: 12
- Joined: Sun Apr 16, 2006 4:52 am
Hi Till,
this is far from being optimal, just quickly thrown together, but hopefully it is a starter.
this is far from being optimal, just quickly thrown together, but hopefully it is a starter.
Code: Select all
--> all handlers
on mouseUp pMouseBtnNo
local tOldTopLeft
local tLeft,tTop,tRight,tBottom
put the topleft of this stack into tOldTopLeft
set the printpaperorientation to "landscape"
answer printer
if it is "cancel" then exit mouseUp
set the rect of this stack to the printpaperrectangle
set the topleft of this stack to tOldTopLeft
put item 1 of the printmargins into tLeft
put item 2 of the printmargins into tTop
put the right of this cd - item 3 of the printmargins into tRight
put the bottom of this cd - item 4 of the printmargins into tBottom
if there is a grp "printOutChart" then delete grp "printOutChart"
if there is a grp "printOutChart_Legend" then delete grp "printOutChart_Legend"
-- set chart properties
local tchart -- holds a reference to the group being created
local tLinesOfData,tTimeDuration
local tData
-- set up the data
repeat with i=0 to 360
put i,sin(i*pi/180),cos(i*pi/180)&cr after tData
end repeat
put the millisecs into tTimeDuration
lock screen
chartsCreateChart "printOutChart",tLeft,tTop,tRight,tBottom
put the result into tChart
set the layer of me to the number of layers
-- set the chart style
set the charts["chartStyle"] of tChart to "lines"
-- Take n lines of data as specified by the thumbpos of the scrollbar
set the charts["data"] of tchart to tData
set the charts["dataIncludesX"] of tChart to true
-- number formats
set the charts["gridXNumberFormat"] of tChart to "#"
set the charts["gridYNumberFormat"] of tChart to "#.00"
-- set legendproperties and show the legend
set the charts["legendNames"] of tchart to "Sine" & cr & "Cosine"
set the charts["showLegend"] of tchart to true
-- The headline of the chart
set the charts["caption"] of tchart to "Working with the grid"
-- The grid settings
-- -- draw n lines for x and y grid
set the charts["gridx"] of tChart to 3
set the charts["gridy"] of tChart to 3
-- -- Show labels
set the charts["showGridXDescription"] of tchart to true
set the charts["showGridYDescription"] of tchart to true
set the charts["gridXDescriptionOrientation" ] of tChart to "normal" -- does not print pretty otherwise
-- -- Grid color
set the charts["gridColor"] of tchart to "dark gray"
-- -- alternating rows and columns
set the charts["gridXFillColor"] of tChart to 240,240,240
set the charts["gridXFillAltColor"] of tChart to 230,230,240
set the charts["gridyFillColor"] of tChart to "white"
set the charts["gridYFillAltColor"] of tChart to "#eeeeff"
-- -- -- Blending needed to show all alternates
set the charts["gridYInk"] of tChart to "blend"
-- linesize for the lines
set the charts["lineSizes"] of tChart to 2
-- force chart to redraw
send "chartsRefresh" to tchart
set the botleft of the chartsLegendId of tchart to the botleft of grc "charts_gridy" of grp "printOutChart"
hide me
print this cd
show me
end mouseUp
-
- VIP Livecode Opensource Backer
- Posts: 12
- Joined: Sun Apr 16, 2006 4:52 am