feat: Performance timeLabel done.
This commit is contained in:
@@ -3,7 +3,7 @@ import dagre from 'cytoscape-dagre';
|
||||
import tippy from 'tippy.js';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
import Gradient from 'javascript-color-gradient'; // 多個色階產生器
|
||||
import TimeLabel from '@/module/timeLabel.js'; // 時間格式轉換器
|
||||
import { getTimeLabel } from '@/module/timeLabel.js'; // 時間格式轉換器
|
||||
|
||||
cytoscape.use( dagre );
|
||||
|
||||
@@ -122,8 +122,8 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
|
||||
// Relative %
|
||||
let textDurRel = text + (optionValue * 100).toFixed(2) + "%";
|
||||
// Timelabel
|
||||
let timeLabelInt = text + TimeLabel(optionValue);
|
||||
let timeLabelFloat = text + TimeLabel(optionValue.toFixed(2));
|
||||
let timeLabelInt = text + getTimeLabel(optionValue);
|
||||
let timeLabelFloat = text + getTimeLabel(optionValue.toFixed(2));
|
||||
|
||||
// 判斷是否為整數,若非整數要取小數點後面兩個值。
|
||||
let textTimeLabel = Math.trunc(optionValue) === optionValue ? timeLabelInt : timeLabelFloat;
|
||||
@@ -180,8 +180,8 @@ export default function cytoscapeMap(mapData, dataLayerType, dataLayerOption, cu
|
||||
// Relative %
|
||||
let edgeDurRel = (optionValue * 100).toFixed(2) + "%";
|
||||
// Timelabel
|
||||
let timeLabelInt = TimeLabel(optionValue);
|
||||
let timeLabelFloat = TimeLabel(optionValue.toFixed(2));
|
||||
let timeLabelInt = getTimeLabel(optionValue);
|
||||
let timeLabelFloat = getTimeLabel(optionValue.toFixed(2));
|
||||
let edgeTimeLabel = Math.trunc(optionValue) === optionValue ? timeLabelInt : timeLabelFloat;
|
||||
|
||||
result = dataLayerOption === 'rel_duration' ? edgeDurRel : edgeTimeLabel;
|
||||
|
||||
Reference in New Issue
Block a user