@@ -2813,8 +2813,13 @@ function build_chart(chart) {
2813
2813
) ;
2814
2814
return ;
2815
2815
}
2816
-
2817
- var table = chart . dom . div . append ( "table" ) ;
2816
+
2817
+ var table = chart . dom . div . append ( "table" )
2818
+ . attr ( "class" , "graphtable" )
2819
+ . style ( "max-width" , chart . dimensions . viewport_width + "px" )
2820
+ . style ( "flex" , "0.9 0.9 auto" )
2821
+ . style ( "width" , 0 )
2822
+ . style ( "word-break" , "break-all" ) ;
2818
2823
2819
2824
var row = table . append ( "tr" )
2820
2825
. classed ( "wrapper" , true )
@@ -2917,13 +2922,8 @@ function build_chart(chart) {
2917
2922
. enter ( )
2918
2923
. append ( "svg" )
2919
2924
. classed ( "svg" , true )
2920
- . attr (
2921
- "width" ,
2922
- chart . dimensions . viewport_width +
2923
- chart . dimensions . margin . left +
2924
- chart . dimensions . margin . right
2925
- )
2926
- . attr ( "height" , get_svg_height ( chart ) ) ;
2925
+ . attr ( "viewBox" , "0 0" + " " + ( chart . dimensions . viewport_width + chart . dimensions . margin . left +
2926
+ chart . dimensions . margin . right ) + " " + ( get_svg_height ( chart ) ) + "" ) ;
2927
2927
2928
2928
chart . chart . defs = chart . chart . svg . append ( "defs" ) ;
2929
2929
if ( ! chart . options . scatterplot ) {
@@ -3647,7 +3647,9 @@ function load_datasets(chart) {
3647
3647
3648
3648
if ( chart . datasets . all . length > chart . dataset_count ) {
3649
3649
console . log ( 'Resizing SVG for chart "' + chart . chart_title + '".' ) ;
3650
- chart . chart . svg . attr ( "height" , get_svg_height ( chart ) ) ;
3650
+ chart . chart . svg . attr ( "height" , get_svg_height ( chart ) )
3651
+ . attr ( "viewBox" , "0 0" + " " + ( chart . dimensions . viewport_width + chart . dimensions . margin . left +
3652
+ chart . dimensions . margin . right ) + " " + ( get_svg_height ( chart ) ) + "" ) ;
3651
3653
console . log ( '...finished resizing SVG for chart "' + chart . chart_title + '".' ) ;
3652
3654
}
3653
3655
@@ -3701,6 +3703,9 @@ exports.create_jschart = function(
3701
3703
stacked = 0 ;
3702
3704
}
3703
3705
3706
+ d3 . select ( '#' + location )
3707
+ . style ( "display" , "flex" )
3708
+
3704
3709
// add an entry to the chart generating queue
3705
3710
charts_queue . defer (
3706
3711
generate_chart ,
@@ -3717,6 +3722,9 @@ exports.create_jschart = function(
3717
3722
exports . finish_page = function ( ) {
3718
3723
// wait for initial chart generation to complete before logging that it is done and changing the page background
3719
3724
// note: chart datasets may still be loading asynchronously
3725
+ d3 . selectAll ( ".svg" )
3726
+ . style ( "width" , '100%' )
3727
+ . style ( "height" , "auto" )
3720
3728
charts_queue . await ( function ( error , results ) {
3721
3729
d3 . select ( "body" ) . classed ( "completedpage" , true ) ;
3722
3730
console . log ( "Finished creating all charts" ) ;
@@ -5374,7 +5382,9 @@ function reset_chart(chart) {
5374
5382
5375
5383
reset_axes_domains ( chart ) ;
5376
5384
5377
- chart . chart . svg . attr ( "height" , get_svg_height ( chart ) ) ;
5385
+ chart . chart . svg . attr ( "height" , get_svg_height ( chart ) )
5386
+ . attr ( "viewBox" , "0 0" + " " + ( chart . dimensions . viewport_width + chart . dimensions . margin . left +
5387
+ chart . dimensions . margin . right ) + " " + ( get_svg_height ( chart ) ) + "" ) ;
5378
5388
5379
5389
chart . state . reset = true ;
5380
5390
}
@@ -5385,7 +5395,7 @@ function get_svg_height(chart) {
5385
5395
chart . dimensions . margin . bottom +
5386
5396
( Math . ceil ( chart . datasets . all . length / chart . state . legend_columns ) -
5387
5397
1 + chart . options . legend_entries . length
5388
- ) * chart . dimensions . legend_properties . row_height ;
5398
+ ) * chart . dimensions . legend_properties . row_height ;
5389
5399
}
5390
5400
5391
5401
function reload_chart ( chart ) {
0 commit comments