How to set the size of MS chart in millimetre instead of pixel in C# -


i trying set size of chart object in millimetre in c# using following code:

var chart = new chart(); chart.renderingdpix = 300; chart.renderingdpiy = 300; chart.creategraphics().pageunit = graphicsunit.millimeter; chart.size = new size(290, 200); // meant 290 millimetre not pixel ... chart.saveimage(@"d:\temp\tttt.png", chartimageformat.png); 

i expect size of saved image around 290 * (300/254) = 3425 pixel, whereas size of image 290 pixel 200 pixel?

i tried set page unit in postpaint event using

private void chartpostpaint(object sender, chartpainteventargs e) {   var g = e.chartgraphics.graphics;   g.pageunit = graphicsunit.millimeter; }  

but not work either! please me how set size of chart in millimetre or inches instead of pixel?

from documentation of chart() seems default measurement unit px.
but, use px input method give value on mm.
write:

private double tomm(int _px) {     return this._px*(300/254); } 

so, have like:

chart.size = new size(tomm(290), tomm(200)); 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -