@@ -17,7 +17,7 @@ import Icon from 'san-mui/Icon';
1717
1818// libs
1919import echarts from 'echarts';
20- import {min, max } from 'lodash';
20+ import {maxBy } from 'lodash';
2121import {originDataToChartData} from '../histogramHelper';
2222import {format, precisionRound} from 'd3-format';
2323
@@ -28,7 +28,7 @@ const highlightLineColor = '#2f4554';
2828const defaultLineColor = '#d14a61';
2929const lineWidth = 1;
3030// the time to refresh chart data
31- const intervalTime = 5 ;
31+ const intervalTime = 15 ;
3232
3333const p = Math.max(0, precisionRound(0.01, 1.01) - 1);
3434const yValueFormat = format('.' + p + 'e');
@@ -88,6 +88,9 @@ export default {
8888
8989 initChartOption() {
9090 this.myChart.clear();
91+
92+ // var ob = this.myChart.getOption();
93+
9194 let data = this.data.get('originData');
9295 let visData = originDataToChartData(data);
9396 let tagInfo = this.data.get('tagInfo');
@@ -99,9 +102,9 @@ export default {
99102 setChartOptions(visData, tag, chartType) {
100103 let grid = {
101104 left: '15%',
102- top: '20 %',
105+ top: '15 %',
103106 right: '10%',
104- bottom: '20 %'
107+ bottom: '8 %'
105108 };
106109
107110 let title = {
@@ -181,8 +184,10 @@ export default {
181184 let ecChart = this.myChart;
182185 let maxStep = -Infinity;
183186 let minStep = Infinity;
184- grid.top = '50%';
185- chartData.forEach(dataItem => {
187+ grid.top = '42%';
188+ grid.left = '4%';
189+ grid.right = '15%';
190+ chartData.forEach((dataItem) => {
186191 let lineData = [];
187192 maxStep = Math.max(dataItem.step, maxStep);
188193 minStep = Math.min(dataItem.step, minStep);
@@ -193,19 +198,20 @@ export default {
193198 });
194199 rawData.push(lineData);
195200 });
196- // Max height in z axis.
197- let Z_HEIGHT = 200;
201+
202+ // Max point in every polygon.
203+ // let maxValuePoints = [];
198204 let option = {
199205 title,
200- color: ['#008c99 '],
206+ color: ['#006069 '],
201207 visualMap: {
202208 type: 'continuous',
203209 show: false,
204210 min: minStep,
205211 max: maxStep,
206212 dimension: 1,
207213 inRange: {
208- colorLightness: [0.3 , 0.7 ]
214+ colorLightness: [0.2 , 0.4 ]
209215 }
210216 },
211217 xAxis: {
@@ -236,7 +242,8 @@ export default {
236242 let points = makePolyPoints(
237243 params.dataIndex,
238244 api.value,
239- api.coord
245+ api.coord,
246+ params.coordSys.y - 5
240247 );
241248 return {
242249 type: 'polygon',
@@ -251,36 +258,47 @@ export default {
251258 };
252259 },
253260 data: rawData
254- }]
261+ }
262+ // {
263+ // type: 'custom',
264+ // dimension: ['x', 'y'],
265+ // renderItem: function (params, api) {
266+
267+
268+ // },
269+ // data: rawData
270+ // }
271+ ]
255272 };
256273
257- function makePolyPoints(dataIndex, getValue, getCoord) {
274+ function makePolyPoints(dataIndex, getValue, getCoord, yValueMapHeight ) {
258275 let points = [];
259276 for (let i = 0; i < rawData[dataIndex].length;) {
260277 let x = getValue(i++);
261278 let y = getValue(i++);
262279 let z = getValue(i++);
263- points.push(getPoint(x, y, z, getCoord));
280+ points.push(getPoint(x, y, z, getCoord, yValueMapHeight ));
264281 }
265282 return points;
266283 }
267284
268- function getPoint(x, y, z, getCoord) {
285+ function getPoint(x, y, z, getCoord, yValueMapHeight ) {
269286 let pt = getCoord([x, y]);
270287 // linear map in z axis
271- pt[1] -= (z - minZ) / (maxZ - minZ) * Z_HEIGHT ;
288+ pt[1] -= (z - minZ) / (maxZ - minZ) * yValueMapHeight ;
272289 return pt;
273290 }
274291
275292 let hoverLine;
293+ let maxLine;
276294 let hoverDots = [];
277295 let tooltip;
278296 let tooltipX;
279297 let tooltipY;
280298
281299 let zr = ecChart.getZr();
282300
283- function removeTooltip() {
301+ function removeTooltip(){
284302 if (hoverLine) {
285303 zr.remove(hoverLine);
286304 zr.remove(tooltip);
@@ -293,13 +311,13 @@ export default {
293311
294312 zr.on('mouseout', e => {
295313 removeTooltip();
296- });
314+ });
297315
298316 zr.on('mousemove', e => {
299317 removeTooltip();
300318 let nearestIndex = findNearestValue(e.offsetX, e.offsetY);
301319 if (nearestIndex) {
302- let getCoord = function (pt) {
320+ let getCoord = function(pt) {
303321 return ecChart.convertToPixel('grid', pt);
304322 };
305323 let linePoints = makePolyPoints(
@@ -316,7 +334,7 @@ export default {
316334 points: linePoints
317335 },
318336 style: {
319- stroke: '#9b9a9a ',
337+ stroke: '#5c5c5c ',
320338 lineWidth: 2
321339 },
322340 z: 999
@@ -388,7 +406,7 @@ export default {
388406
389407 tooltipY = new echarts.graphic.Text({
390408 position: [
391- gridRect.x + gridRect.width,
409+ gridRect.x + gridRect.width,
392410 linePoints[linePoints.length - 1][1]
393411 ],
394412 style: {
0 commit comments