@@ -2813,8 +2813,13 @@ function build_chart(chart) {
28132813 ) ;
28142814 return ;
28152815 }
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" ) ;
28182823
28192824 var row = table . append ( "tr" )
28202825 . classed ( "wrapper" , true )
@@ -2917,13 +2922,8 @@ function build_chart(chart) {
29172922 . enter ( )
29182923 . append ( "svg" )
29192924 . 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 ) ) + "" ) ;
29272927
29282928 chart . chart . defs = chart . chart . svg . append ( "defs" ) ;
29292929 if ( ! chart . options . scatterplot ) {
@@ -3647,7 +3647,9 @@ function load_datasets(chart) {
36473647
36483648 if ( chart . datasets . all . length > chart . dataset_count ) {
36493649 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 ) ) + "" ) ;
36513653 console . log ( '...finished resizing SVG for chart "' + chart . chart_title + '".' ) ;
36523654 }
36533655
@@ -3701,6 +3703,9 @@ exports.create_jschart = function(
37013703 stacked = 0 ;
37023704 }
37033705
3706+ d3 . select ( '#' + location )
3707+ . style ( "display" , "flex" )
3708+
37043709 // add an entry to the chart generating queue
37053710 charts_queue . defer (
37063711 generate_chart ,
@@ -3717,6 +3722,9 @@ exports.create_jschart = function(
37173722exports . finish_page = function ( ) {
37183723 // wait for initial chart generation to complete before logging that it is done and changing the page background
37193724 // note: chart datasets may still be loading asynchronously
3725+ d3 . selectAll ( ".svg" )
3726+ . style ( "width" , '100%' )
3727+ . style ( "height" , "auto" )
37203728 charts_queue . await ( function ( error , results ) {
37213729 d3 . select ( "body" ) . classed ( "completedpage" , true ) ;
37223730 console . log ( "Finished creating all charts" ) ;
@@ -5374,7 +5382,9 @@ function reset_chart(chart) {
53745382
53755383 reset_axes_domains ( chart ) ;
53765384
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 ) ) + "" ) ;
53785388
53795389 chart . state . reset = true ;
53805390}
@@ -5385,7 +5395,7 @@ function get_svg_height(chart) {
53855395 chart . dimensions . margin . bottom +
53865396 ( Math . ceil ( chart . datasets . all . length / chart . state . legend_columns ) -
53875397 1 + chart . options . legend_entries . length
5388- ) * chart . dimensions . legend_properties . row_height ;
5398+ ) * chart . dimensions . legend_properties . row_height ;
53895399}
53905400
53915401function reload_chart ( chart ) {
0 commit comments