Skip to content

Commit 002d30e

Browse files
committed
disabled zoom
1 parent 50a78e3 commit 002d30e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

plotly/figure_factory/_sparkline.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
1717
column_width=None, show_titles=False, textalign='center',
1818
horizontal_spacing=0.0, vertical_spacing=0.0,
1919
alternate_row_color=True,
20-
lane_colors=('rgba(249, 247, 244, 0.5)',
21-
'rgba(255, 253, 250, 0.5)'),
20+
lane_colors=('rgba(249, 247, 244, 1.0)',
21+
'rgba(255, 253, 250, 1.0)'),
2222
scatter_options=None, **layout_options):
2323
"""
2424
Returns figure for sparkline.
@@ -39,8 +39,10 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
3939
above their respective column
4040
:param (str) textalign: aligns name and avg cells. Use either 'center',
4141
'left', or 'right'. Default='center'.
42-
:param (float) horizontal_spacing:
43-
:param (float) vertical_spacing :
42+
:param (float) horizontal_spacing: Space between subplot columns.
43+
Applied to all columns
44+
:param (float) vertical_spacing: Space between subplot rows.
45+
Applied to all rows
4446
:param (float) alternate_row_color: set to True to enable the alternate
4547
row coloring of the chart. Uses the colors from param 'lane_colors'
4648
:param (list) lane_colors: a list/tuple of two colors that are used to
@@ -97,7 +99,7 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
9799

98100
# layout options
99101
fig['layout'].update(
100-
title='Sparkline Chart',
102+
title='',
101103
annotations=[],
102104
showlegend=False
103105
)
@@ -217,7 +219,7 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
217219

218220
if alternate_row_color:
219221
bkgcolor = go.Scatter(
220-
x=[0, 2 * max(df[key])],
222+
x=[0, max(df[key])],
221223
y=[1, 1],
222224
fill='tozeroy',
223225
mode='lines',
@@ -236,7 +238,7 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
236238

237239
fig['layout']['yaxis{}'.format(
238240
j * num_of_chart_types + (c + 1)
239-
)]['range'] = [0, 1]
241+
)]['range'] = [0, 1]
240242
elif chart == 'line':
241243
trace_line = go.Scatter(
242244
x=range(len(df[key])),
@@ -347,6 +349,10 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
347349
VALID_CHART_TYPES, 'or')
348350
)
349351
)
352+
for x_y in ['xaxis', 'yaxis']:
353+
fig['layout']['{}{}'.format(
354+
x_y, j * num_of_chart_types + (c + 1)
355+
)]['fixedrange'] = True
350356

351357
# show titles
352358
if show_titles:

0 commit comments

Comments
 (0)