From b93f9ec59857bb27efc4bccc3f33b0578d3efc41 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 26 Aug 2016 11:45:46 -0700 Subject: [PATCH] [line chart] adding option for circle markers (#1006) --- caravel/assets/visualizations/nvd3_vis.js | 6 ++++++ caravel/forms.py | 7 +++++++ caravel/viz.py | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/caravel/assets/visualizations/nvd3_vis.js b/caravel/assets/visualizations/nvd3_vis.js index d131928b86a91..0809f56070701 100644 --- a/caravel/assets/visualizations/nvd3_vis.js +++ b/caravel/assets/visualizations/nvd3_vis.js @@ -309,6 +309,12 @@ function nvd3Vis(slice) { .attr('width', width) .call(chart); + if (fd.show_markers) { + svg.selectAll('.nv-point') + .style('stroke-opacity', 1) + .style('fill-opacity', 1); + } + return chart; }); diff --git a/caravel/forms.py b/caravel/forms.py index 5de93cf830a80..3cd689230d404 100755 --- a/caravel/forms.py +++ b/caravel/forms.py @@ -235,6 +235,13 @@ def __init__(self, viz): "default": False, "description": "" }), + 'show_markers': (BetterBooleanField, { + "label": _("Show Markers"), + "default": False, + "description": ( + "Show data points as circle markers on top of the lines " + "in the chart") + }), 'show_bar_value': (BetterBooleanField, { "label": _("Bar Values"), "default": False, diff --git a/caravel/viz.py b/caravel/viz.py index 5413abb859bfa..77cad106fdfa3 100755 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -984,7 +984,8 @@ class NVD3TimeSeriesViz(NVD3Viz): ('show_brush', 'show_legend'), ('rich_tooltip', 'y_axis_zero'), ('y_log_scale', 'contribution'), - ('line_interpolation', 'x_axis_showminmax'), + ('show_markers', 'x_axis_showminmax'), + ('line_interpolation', None), ('x_axis_format', 'y_axis_format'), ('x_axis_label', 'y_axis_label'), ),