Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3f787de
modified something in frontend directory
deqingli Dec 25, 2017
002a56f
modified gitignore
deqingli Dec 25, 2017
db35fce
remove node_modules
deqingli Dec 25, 2017
20b60eb
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Dec 25, 2017
5e68118
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Dec 27, 2017
b1d0830
modify the data format for graph
deqingli Dec 27, 2017
7e374aa
add label for each edge in the graph data formate
deqingli Dec 27, 2017
fa40306
Merge branch 'develop' into develop
deqingli Dec 27, 2017
9634ca0
Merge branch 'develop' into develop
deqingli Dec 27, 2017
7f1ef12
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Dec 27, 2017
7dbbe03
merge scalars and image
deqingli Dec 27, 2017
3f5d5db
Merge branch 'develop' of https://github.com/deqingli/VisualDL-1 into…
deqingli Dec 27, 2017
dc542b9
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Jan 8, 2018
f632ead
Merge branch 'develop' into develop
deqingli Jan 8, 2018
52ede82
Merge branch 'develop' into develop
deqingli Jan 9, 2018
a4944b7
update histogram layout and style
deqingli Jan 11, 2018
dd33782
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Jan 11, 2018
1ba861b
Merge branch 'develop' of https://github.com/deqingli/VisualDL-1 into…
deqingli Jan 11, 2018
9783100
modified solve the histogram outlier problem
deqingli Jan 12, 2018
3eacf62
merge online code
deqingli Jan 12, 2018
f565d5e
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Jan 12, 2018
6255bc2
resolve histogram over range
deqingli Jan 12, 2018
9daa763
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Jan 12, 2018
60c5003
moidify the height of grid and the refresh interval
deqingli Jan 12, 2018
b7b635a
Merge remote-tracking branch 'upstream/develop' into develop
deqingli Jan 12, 2018
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 39 additions & 21 deletions frontend/src/histogram/ui/chart.san
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Icon from 'san-mui/Icon';

// libs
import echarts from 'echarts';
import {min, max} from 'lodash';
import {maxBy} from 'lodash';
import {originDataToChartData} from '../histogramHelper';
import {format, precisionRound} from 'd3-format';

Expand All @@ -28,7 +28,7 @@ const highlightLineColor = '#2f4554';
const defaultLineColor = '#d14a61';
const lineWidth = 1;
// the time to refresh chart data
const intervalTime = 5;
const intervalTime = 15;

const p = Math.max(0, precisionRound(0.01, 1.01) - 1);
const yValueFormat = format('.' + p + 'e');
Expand Down Expand Up @@ -88,6 +88,9 @@ export default {

initChartOption() {
this.myChart.clear();

// var ob = this.myChart.getOption();

let data = this.data.get('originData');
let visData = originDataToChartData(data);
let tagInfo = this.data.get('tagInfo');
Expand All @@ -99,9 +102,9 @@ export default {
setChartOptions(visData, tag, chartType) {
let grid = {
left: '15%',
top: '20%',
top: '15%',
right: '10%',
bottom: '20%'
bottom: '8%'
};

let title = {
Expand Down Expand Up @@ -181,8 +184,10 @@ export default {
let ecChart = this.myChart;
let maxStep = -Infinity;
let minStep = Infinity;
grid.top = '50%';
chartData.forEach(dataItem => {
grid.top = '42%';
grid.left = '4%';
grid.right = '15%';
chartData.forEach((dataItem) => {
let lineData = [];
maxStep = Math.max(dataItem.step, maxStep);
minStep = Math.min(dataItem.step, minStep);
Expand All @@ -193,19 +198,20 @@ export default {
});
rawData.push(lineData);
});
// Max height in z axis.
let Z_HEIGHT = 200;

// Max point in every polygon.
// let maxValuePoints = [];
let option = {
title,
color: ['#008c99'],
color: ['#006069'],
visualMap: {
type: 'continuous',
show: false,
min: minStep,
max: maxStep,
dimension: 1,
inRange: {
colorLightness: [0.3, 0.7]
colorLightness: [0.2, 0.4]
}
},
xAxis: {
Expand Down Expand Up @@ -236,7 +242,8 @@ export default {
let points = makePolyPoints(
params.dataIndex,
api.value,
api.coord
api.coord,
params.coordSys.y - 5
);
return {
type: 'polygon',
Expand All @@ -251,36 +258,47 @@ export default {
};
},
data: rawData
}]
}
// {
// type: 'custom',
// dimension: ['x', 'y'],
// renderItem: function (params, api) {


// },
// data: rawData
// }
]
};

function makePolyPoints(dataIndex, getValue, getCoord) {
function makePolyPoints(dataIndex, getValue, getCoord, yValueMapHeight) {
let points = [];
for (let i = 0; i < rawData[dataIndex].length;) {
let x = getValue(i++);
let y = getValue(i++);
let z = getValue(i++);
points.push(getPoint(x, y, z, getCoord));
points.push(getPoint(x, y, z, getCoord, yValueMapHeight));
}
return points;
}

function getPoint(x, y, z, getCoord) {
function getPoint(x, y, z, getCoord, yValueMapHeight) {
let pt = getCoord([x, y]);
// linear map in z axis
pt[1] -= (z - minZ) / (maxZ - minZ) * Z_HEIGHT;
pt[1] -= (z - minZ) / (maxZ - minZ) * yValueMapHeight;
return pt;
}

let hoverLine;
let maxLine;
let hoverDots = [];
let tooltip;
let tooltipX;
let tooltipY;

let zr = ecChart.getZr();

function removeTooltip() {
function removeTooltip(){
if (hoverLine) {
zr.remove(hoverLine);
zr.remove(tooltip);
Expand All @@ -293,13 +311,13 @@ export default {

zr.on('mouseout', e => {
removeTooltip();
});
});

zr.on('mousemove', e => {
removeTooltip();
let nearestIndex = findNearestValue(e.offsetX, e.offsetY);
if (nearestIndex) {
let getCoord = function (pt) {
let getCoord = function(pt) {
return ecChart.convertToPixel('grid', pt);
};
let linePoints = makePolyPoints(
Expand All @@ -316,7 +334,7 @@ export default {
points: linePoints
},
style: {
stroke: '#9b9a9a',
stroke: '#5c5c5c',
lineWidth: 2
},
z: 999
Expand Down Expand Up @@ -388,7 +406,7 @@ export default {

tooltipY = new echarts.graphic.Text({
position: [
gridRect.x + gridRect.width,
gridRect.x + gridRect.width,
linePoints[linePoints.length - 1][1]
],
style: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scalars/ui/chart.san
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const lineWidth = 1.5;
const minQuantile = 0.05;
const maxQuantile = 0.95;
// the time to refresh chart data
const intervalTime = 30;
const intervalTime = 15;

export default {

Expand Down