view box and bootstrap

94 views
Skip to first unread message

Karam Tayeb

unread,
Mar 5, 2015, 4:44:12 AM3/5/15
to d3...@googlegroups.com
every since i try to use view box with bootstrap dons work but when i using in different html it work.

dose bootstrap support viewbox ?? any idea ??



var con1svg = d3.select('#con1svg').append('svg')
  // .attr('width',width + margin.left + margin.right)
  // .attr('height',height + margin.top + margin.bottom)
 .attr("viewBox", "0 0 535 600")
   .attr("preserveAspectRatio", "xMinxMax")
  .append('g')//grouping rect
  .attr('transform','translate('+ margin.left +', '+margin.top +')')
  .append('g')//grouping rect
  // .attr('transform','translate('+ margin.left +', '+margin.top +')')
    .selectAll('rect').data(bardata1)
   //ENTER
    .enter().append('rect')
    .style('fill', function(d,i) {return colors(i);})
    .attr('width', xScale.rangeBand())
    //below...if xScale(i) then #14 will be empty...must be xScale(i + 1)
    .attr('x', function(d,i) {return xScale(i + 1);})//xScale(i + 1)
    .attr("height", 0)
    .attr('y', height)// zero for trans purpose



best regards 

in...@rheindata.com

unread,
Mar 7, 2015, 5:13:31 AM3/7/15
to d3...@googlegroups.com
I am new to JS programming and to bootstrap, so I hope my answer is not trivial, but have you put the following line into your header section?

    <meta name="viewport" content="width=device-width, initial-scale=1">

Karam Tayeb

unread,
Mar 7, 2015, 5:27:06 AM3/7/15
to d3...@googlegroups.com
Hello, thank you so much in the first place for answering my question. 

Second of all , bootstrap already include the line of script which make the web page responsive but not the SVG. 
if noted my question is all about the svgs where all the chart will be located. so in order to make the chart responsive it should be away the makes the svg responsive with page size either by using css file or the view box , but when it become to bootstrap the view-box solution doesn't react as i am using different web environment that docent include bootstrap. I hope that some find solution for me.

thrid, You are welcome on D3 world :).



Best regards

Karam Tayeb

unread,
Mar 11, 2015, 9:22:52 AM3/11/15
to d3...@googlegroups.com
anyone can provide any help with viewbox in bootstrap ?? it doesn't work at all ?

Andy Thornton

unread,
Mar 11, 2015, 9:27:26 AM3/11/15
to d3...@googlegroups.com

That’s not exactly a D3 specific question. Perhaps try Stackoverflow‘s Bootstrap tag.


--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages