summaryrefslogtreecommitdiff
path: root/src/components/app/sidebars/elements/LoadChartComponent.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-11-03 21:55:14 +0100
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-11-03 21:55:14 +0100
commitd6f2296d60399fa0156c3908fa63e61fb0e3b4bf (patch)
treeac4e0885738286277b7e8b2276d7b67aac293f01 /src/components/app/sidebars/elements/LoadChartComponent.js
parent285026488df4c82c3f31fe093a4f44c579331ac0 (diff)
Add label to current tick line in state charts
This vertically-oriented label gives the user an indication of what that blue bar actually means in the graph, for the case that this was not clear from the UI itself. Fixes #31
Diffstat (limited to 'src/components/app/sidebars/elements/LoadChartComponent.js')
-rw-r--r--src/components/app/sidebars/elements/LoadChartComponent.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/components/app/sidebars/elements/LoadChartComponent.js b/src/components/app/sidebars/elements/LoadChartComponent.js
index 6f66010e..5f0d40cb 100644
--- a/src/components/app/sidebars/elements/LoadChartComponent.js
+++ b/src/components/app/sidebars/elements/LoadChartComponent.js
@@ -4,6 +4,7 @@ import SvgSaver from "svgsaver";
import {
VictoryAxis,
VictoryChart,
+ VictoryLabel,
VictoryLine,
VictoryScatter
} from "victory";
@@ -56,9 +57,17 @@ const VictoryChartComponent = ({ data, currentTick, showCurrentTick }) => (
<VictoryScatter data={data} />
{showCurrentTick ? (
<VictoryLine
+ labelComponent={
+ <VictoryLabel renderInPortal angle={90} dy={-5} dx={60} />
+ }
data={[{ x: currentTick + 1, y: 0 }, { x: currentTick + 1, y: 1 }]}
+ labels={point =>
+ point.y === 1
+ ? "Current tick : " + convertSecondsToFormattedTime(currentTick)
+ : ""}
style={{
- data: { stroke: "#00A6D6", strokeWidth: 3 }
+ data: { stroke: "#00A6D6", strokeWidth: 4 },
+ labels: { fill: "#00A6D6" }
}}
/>
) : (