FVANCOP / ChartNew.js

MIT License
420 stars 143 forks source link

Wrong Display (Scaling?) when setting style width/heigth to 100% #493

Open MasterOfBytes opened 7 years ago

MasterOfBytes commented 7 years ago

If you set the canvas element to style="width:100%; height: 100%;" to match the parent, it doesn't scale up. edit: the same occours when setting absolute values (xxx px) per style.

(ChartJS worked if i remember right) (Tested with Chrome & Firefox) image

FVANCOP commented 7 years ago

Can you please send the html to my email address. You will find it in the code of chartnew.js

FVANCOP commented 7 years ago

Thanks for the sending the code !

Problem appears when the canvas was defined like this :

A fix has been introduced in the last version. I hope this solution is correct in all cases (not sure what you could specify in the style definitions...; Only "px" values ? Did not find something else on the web documentation).

MasterOfBytes commented 7 years ago

Thanks for your effort. But this still doesn't solve the Problem the right way. I think you have to determinate the width and height in another way? Because when you set the width and/or height to a percent value it is still the same.

You can use the sample again: updateChartPie.html This time replace it with:

document.write("<canvas id=\"canvas_Pie\" style=\"height: 500px; width:100%;\"></canvas>");
FVANCOP commented 7 years ago

Hi,

A new version has been published. I hope that it will be (more) correct.

@MasterOfBytes : Thanks you for reporting the problem and for the quick feedback.

Regards, François