echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] 折线图绘制精度问题,小数位被忽略

Open mansion-sun opened this issue 3 years ago • 2 comments

Version

^5.2.2

Link to Minimal Reproduction

https://codesandbox.io/s/zen-spence-q6c6fw?file=/src/index.js

Steps to Reproduce

使用折线图绘制小数位数包含小数点后七位的折线图

Current Behavior

const data = [ [107.0004511, 35.5000359], [107.1504517, 35.500035], [107.1504508, 35.4000348], [107.3004514, 35.4000338], [107.3004492, 35.1500331], [107.0004479, 35.1500349], [107.0004511, 35.5000359] ];

const dataset = data.map(m => ({ value: m, }));

option = { tooltip: { formatter: function (param) { param = param[0] || param; return [ ${param?.data.name} (${param?.seriesName})<hr size=1 style="margin: 3px 0">, '经度:' + param.data.value[0] + '°;', '纬度:' + param.data.value[1] + '°
', ].join(''); } }, xAxis: [ { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), name: "经度", axisLabel: { formatter: function (value, index) { return value.toFixed(1) + '°'; } }, minorTick: { show: true }, minorSplitLine: { show: true } }, { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), minInterval: 0.0000001, maxInterval: 10, } ], yAxis: [ { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), name: "纬度", axisLabel: { formatter: function (value, index) { return value.toFixed(1) + '°'; } }, minorSplitLine: { show: true, } }, { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), minInterval: 0.0000001, maxInterval: 10, } ], series: [ { data: dataset, type: 'line' } ] };

点位图

Expected Behavior

分布图 如上图,三个点位可以通过小数点区分微小差别

Environment

- OS:window7
- Browser:Chrome版本 91.0.4472.106(正式版本) (64 位)
- Framework:react"^17.0.2"

Any additional comments?

No response

mansion-sun avatar Aug 24 '22 03:08 mansion-sun

@mansion-sun It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED

TITLE

[Bug] Line chart drawing accuracy issue, decimal places are ignored

BODY

Version

^5.2.2

Link to Minimal Reproduction

https://codesandbox.io/s/zen-spence-q6c6fw?file=/src/index.js

Steps to Reproduce

Use a line chart to draw a line chart with seven decimal places

Current Behavior

const data = [ [107.0004511, 35.5000359], [107.1504517, 35.500035], [107.1504508, 35.4000348], [107.3004514, 35.4000338], [107.3004492, 35.1500331], [107.0004479, 35.1500349], [107.0004511, 35.5000359] ];

const dataset = data.map(m => ({ value: m, }));

option = { tooltip: { formatter: function (param) { param = param[0] || param; return [ ${param?.data.name} (${param?.seriesName})<hr size=1 style="margin: 3px 0">, 'longitude:' + param.data.value[0] + '°;', 'Latitude:' + param.data.value[1] + '°
', ].join(''); } }, xAxis: [ { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), name: "longitude", axisLabel: { formatter: function (value, index) { return value.toFixed(1) + '°'; } }, minorTick: { show: true }, minorSplitLine: { show: true } }, { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), minInterval: 0.0000001, maxInterval: 10, } ], yAxis: [ { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), name: "Latitude", axisLabel: { formatter: function (value, index) { return value.toFixed(1) + '°'; } }, minorSplitLine: { show: true, } }, { min: value => (value?.min - 0.1).toFixed(1), max: value => (value?.max + 0.1).toFixed(1), minInterval: 0.0000001, maxInterval: 10, } ], series: [ { data: dataset, type: 'line' } ] };

Bitmap

Expected Behavior

Distribution map As shown in the figure above, the three points can be distinguished by the decimal point to distinguish the slight difference

Environment

- OS:window7
- Browser: Chrome version 91.0.4472.106 (official version) (64-bit)
- Framework:react "^17.0.2"

Any additional comments?

No response

echarts-bot[bot] avatar Aug 24 '22 03:08 echarts-bot[bot]

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

github-actions[bot] avatar Aug 23 '24 21:08 github-actions[bot]

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

github-actions[bot] avatar Aug 30 '24 21:08 github-actions[bot]