From 77655b72adc27d633ce9e0e5d08d4bf73f515e23 Mon Sep 17 00:00:00 2001 From: abigale Li Date: Mon, 15 Jan 2018 21:48:56 +0800 Subject: [PATCH] resolve histogram hover circle problem (#153) --- frontend/mock/data/plugin/histograms/tags.js | 5 +++++ frontend/src/histogram/ui/chart.san | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/mock/data/plugin/histograms/tags.js b/frontend/mock/data/plugin/histograms/tags.js index 8a7cad30..71c747f7 100644 --- a/frontend/mock/data/plugin/histograms/tags.js +++ b/frontend/mock/data/plugin/histograms/tags.js @@ -22,6 +22,11 @@ module.exports = function (path, queryParam, postParam) { { "displayName": "layer1/Wx_plus_b/pre_activations", "description": "" + }, + "layer1/Wx_plus_b/pre_activations_1": + { + "displayName": "layer1/Wx_plus_b/pre_activations_1", + "description": "" } } } diff --git a/frontend/src/histogram/ui/chart.san b/frontend/src/histogram/ui/chart.san index 0c22e59a..d6573c73 100644 --- a/frontend/src/histogram/ui/chart.san +++ b/frontend/src/histogram/ui/chart.san @@ -24,6 +24,7 @@ import {format, precisionRound} from 'd3-format'; import {getPluginHistogramsHistograms} from '../../service'; let zrDrawElement = {}; +zrDrawElement.hoverDots = []; // the time to refresh chart data const intervalTime = 15; @@ -152,6 +153,9 @@ export default { }, yAxis: { type: 'value', + axisLine: { + onZero: false + }, axisLabel: { formatter(value, index) { return yValueFormat(value); @@ -224,6 +228,11 @@ export default { axisLine: { onZero: false }, + axisLabel: { + formatter: function (value) { + return Math.round(value * 100) / 100; + } + }, splitLine: { show: false } @@ -283,8 +292,6 @@ export default { return pt; } - zrDrawElement.hoverDots = []; - let zr = ecChart.getZr(); function removeTooltip() { @@ -361,7 +368,7 @@ export default { zrDrawElement.tooltip = new echarts.graphic.Text({ position: [e.offsetX + 30, e.offsetY - 50], style: { - text: hoveredItem.items[nearestIndex.binIndex][3], + text: yValueFormat(hoveredItem.items[nearestIndex.binIndex][3]), textFill: '#000', fontSize: 14, textBackgroundColor: '#eee', -- GitLab