I have the following code:
wm title . "YouTube Weekly Views"
blt::barchart .bc -plotbackground black
.bc axis configure y -stepsize 100
.bc element create best -xdata ${weekArr} -ydata
${viewsArr} -label {} pack .bc -side top -expand yes
-fill both
# Create a image to hold the graph, use the "snap" subcommand and
then # write the image to a file.
image create photo snapshot
.bc snap snapshot
snapshot write ${directory}${imageName} -format png
# Display the barchart
exec gwenview ${directory}${imageName} &
# exit
My views are going up and so are the weeks, but the generated image is
always 400x400.
The barchart itself is expanding, which I saw when putting the exit
into comment.
(At the moment I am only interested in the graphic file.)
So why does snapshot not honour the dimensions of the barchart?
On Sun, 12 Nov 2023 13:43:11 +0100
Cecil Westerhof <Cecil@decebal.nl> wrote:
I have the following code:
wm title . "YouTube Weekly Views"
blt::barchart .bc -plotbackground black
.bc axis configure y -stepsize 100
.bc element create best -xdata ${weekArr} -ydata
${viewsArr} -label {} pack .bc -side top -expand yes
-fill both
# Create a image to hold the graph, use the "snap" subcommand and
then # write the image to a file.
image create photo snapshot
.bc snap snapshot
snapshot write ${directory}${imageName} -format png
# Display the barchart
exec gwenview ${directory}${imageName} &
# exit
My views are going up and so are the weeks, but the generated image is
always 400x400.
The barchart itself is expanding, which I saw when putting the exit
into comment.
(At the moment I am only interested in the graphic file.)
So why does snapshot not honour the dimensions of the barchart?
To change the window size, add a -width and/or -height option to the barchart, such as:
blt::barchart .bc -plotbackground black -width 1000 -height 300
or:
.bc configure -width 1000 -height 300
You won't get a snapshot the correct size just yet, so before you
say snap:
update idletasks
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 406 |
Nodes: | 16 (2 / 14) |
Uptime: | 107:29:21 |
Calls: | 8,527 |
Calls today: | 6 |
Files: | 13,209 |
Messages: | 5,920,299 |