Repository: napjon/krisk

Issue:
Line Plot should have default trigger axis and axis pointer shadow

Discussion:

Patch:
diff --git a/krisk/plot/make_chart.py b/krisk/plot/make_chart.py
index 924e015..68e3c41 100644
--- a/krisk/plot/make_chart.py
+++ b/krisk/plot/make_chart.py
@@ -43,6 +43,9 @@ def make_chart(df, **kwargs):
     if kwargs.get('y', None):
         chart.set_ylabel(kwargs['y'])
 
+    if kwargs['type'] == 'line':
+        chart.set_tooltip_style(trigger='axis',axis_pointer='shadow')
+
     if kwargs['type'] in ['bar', 'line', 'hist']:
         set_bar_line_chart(chart, df, **kwargs)
 


Test patch:
diff --git a/krisk/tests/test_plot.py b/krisk/tests/test_plot.py
index 50435da..13b78e3 100644
--- a/krisk/tests/test_plot.py
+++ b/krisk/tests/test_plot.py
@@ -92,6 +92,8 @@ def test_line(gapminder):
         annotate='all')
     opt = read_option_tests('line.json')
     assert_barline_data(p, opt)
+    assert p.option['tooltip']['axisPointer']['type'] == 'shadow'
+    assert p.option['tooltip']['trigger'] == 'axis'
 
 def test_smooth_line(gapminder):
 
@@ -134,6 +136,7 @@ def test_sort_bar_line(gapminder):
                                      'name': 'Africa',
                                      'type': 'line'}
 
+
 def test_hist(gapminder):
     p1 = kk.hist(gapminder,'lifeExp',bins=10)
     opt1  = read_option_tests('hist_x.json')