zingchart / zingchart-vue

A Vue component to create charts with ZingChart
https://www.zingchart.com/docs/integrations/vue
MIT License
26 stars 5 forks source link

Changing height is not redrawing the graph #2

Closed mertgonul closed 4 years ago

mertgonul commented 4 years ago

When I change width of the graph it is adjusting itself to be responsive but when I change the height it stays at same height.

Original Not responsive

@mike-schultz

mertgonul commented 4 years ago
Screen Shot 2020-01-06 at 02 30 12

That's how the chart is behaving when you change the width but changing the height is not auto-adjusting height of the graph.

mike-schultz commented 4 years ago

@mertgonul ZingChart itself specifically acts as divs would, having an arbitrary width and an implicit height.

If you would like a dynamic height, I would suggest setting the zingchart-vue component's height to 100%, and controlling the overall height in it's parent container:

  <div style="height:200px">
    <zingchart :height="'100%'" ref="myChart" 
               :data="{type: 'line', legend: {}, series: [{values: [1,4,6,3,5,6]}]}" >
    </zingchart>
  </div>
mertgonul commented 4 years ago

@mertgonul ZingChart itself specifically acts as divs would, having an arbitrary width and an implicit height.

If you would like a dynamic height, I would suggest setting the zingchart-vue component's height to 100%, and controlling the overall height in it's parent container:

  <div style="height:200px">
    <zingchart :height="'100%'" ref="myChart" 
               :data="{type: 'line', legend: {}, series: [{values: [1,4,6,3,5,6]}]}" >
    </zingchart>
  </div>

Thank you. Adding "height attribute" solved my problem.