Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Change the used interpolation and set the fill to the point's colour

Roland Geider6953b516e3f5
diff --git a/manager/static/css/workout-manager.css b/manager/static/css/workout-manager.css
index 479cbd3b8..25da75386 100644
--- a/manager/static/css/workout-manager.css
+++ b/manager/static/css/workout-manager.css
@@ -190,6 +190,57 @@ circle{
cursor: pointer;
}
+// Color series from d3.scale.category10()
+circle.color-1f77b4:hover
+{
+ fill: #1f77b4;
+}
+
+circle.color-ff7f0e:hover
+{
+ fill: #ff7f0e;
+}
+
+circle.color-2ca02c:hover
+{
+ fill: #2ca02c;
+}
+
+circle.color-d62728:hover
+{
+ fill: #d62728;
+}
+
+circle.color-9467bd:hover
+{
+ fill: #9467bd;
+}
+
+circle.color-8c564b:hover
+{
+ fill: #8c564b;
+}
+
+circle.color-e377c2:hover
+{
+ fill: #e377c2;
+}
+
+circle.color-7f7f7f:hover
+{
+ fill: #7f7f7f;
+}
+
+circle.color-bcbd22:hover
+{
+ fill: #bcbd22;
+}
+
+circle.color-17becf:hover
+{
+ fill: #17becf;
+}
+
/**************************************************************
diff --git a/manager/static/js/workout-manager.js b/manager/static/js/workout-manager.js
index 1c1a3707a..34e4ad5fc 100644
--- a/manager/static/js/workout-manager.js
+++ b/manager/static/js/workout-manager.js
@@ -569,7 +569,8 @@ function weight_log_chart(data, div_id, reps_i18n)
.orient("left");
var line = d3.svg.line()
- .interpolate("basis")
+ .interpolate("cardinal")
+ .tension(0.6)
.x(function(d) { return x(d.date); })
.y(function(d) { return y(d.weight); });
@@ -639,17 +640,18 @@ function weight_log_chart(data, div_id, reps_i18n)
.attr("class", "line")
.attr("d", function(d) { return line(d.values); })
.style("stroke", function(d) { return color(d.name); });
-
+
reps.forEach(function(d){
- color_name = d.name
+ color_name = d.name
temp_name = hex_random();
-
+ color_class = 'color-' + color(color_name).replace('#', '');
+
svg.selectAll(".dot" + temp_name)
.data(d.values)
.enter().append("circle")
- .attr("class", "dot")
+ .attr("class", "dot " + color_class)
.attr("cx", line.x())
- .attr("cy", line.y())
+ .attr("cy", line.y())
.attr("r", 5)
.style("stroke", function(d) {
return color(color_name);