简体   繁体   中英

Auto Scale y axis in real time graph

我正在尝试绘制一个实时图,其中x轴的范围从0到-40,y轴的范围从0到200000000。如何在C中自动缩放该图?

Not sure if I understood your question correctly. If what you are trying to archive is to fit the samples into an area of WxH pixels you can just scale them:

float d = max_y - min_y;
float s = (sample - min_y) / d;
int y = s * height;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM