XCharts-Team / XCharts

A charting and data visualization library for Unity. Unity数据可视化图表插件。
https://xcharts-team.github.io
MIT License
3.31k stars 570 forks source link

UpdateXYData方法导致精度变化问题 #238

Closed shangchengwen closed 1 year ago

shangchengwen commented 1 year ago
public bool UpdateXYData(int index, float xValue, float yValue)
{
        var flag1 = UpdateData(index, 0, xValue);
        var flag2 = UpdateData(index, 1, yValue);
        return flag1 || flag2;
}

float转换成double的时候精度会发生变化

建议修改为 public bool UpdateXYData(int index, double xValue, double yValue) 或 decimal t1 = (decimal)xValue; decimal t2 = (decimal)yValue; var flag1 = UpdateData(index, 0, (double)t1); var flag2 = UpdateData(index, 1, (double)t2);