panosoft / node-chartist

SVG Charts on the server.
The Unlicense
83 stars 20 forks source link

Chartist not responsive in node js #21

Open adeete opened 6 years ago

adeete commented 6 years ago

` co(function * () { const options = (Chartist) => ({ showArea:true, width:'110%', height:300, axisX: { title: 'Timestamp' , showGrid:true, offset:40, position: 'end', type: Chartist.AutoScaleAxis, divisor: 8, scaleMinSpace: 40, labelInterpolationFnc: function(value) { return moment(value).format('MM do,YYY'); } }, axisY: { showGrid:true, title: "temperature" , high:100, scaleMinSpace: 20 }, chartPadding: { right: 10, bottom: 0, left: 0 }, fullWidth: true
} ) const line2 = yield generate('line', options, { series:[ data.map(function(s) { return {x: s.transDate, y: s.temperature, meta: s.temperature + ' on ' + moment(s.timestamp).format('YYYY-MM-DD')}; }) ], })
var line3 =line2.replace("ct-chart","ct-chart ct-golden-section"); console.log(line3);

    res.render('index',{line:line3});
})`

Whatever value i give or tweak the css until i specify width in node js in px or simple number it does not work.Even after manually adding ct-chart-golden-section it did not become responsive.

AshMcConnell commented 5 years ago

I'm finding the same issue. Unless I specify the width / height explicitly the chart doesn't work properly. Is there any workarounds for this?