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 <[email protected]> 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: | 714 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 134:59:07 |
| Calls: | 12,087 |
| Files: | 14,997 |
| Messages: | 6,517,357 |