@@ -17,8 +17,8 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
17
17
column_width = None , show_titles = False , textalign = 'center' ,
18
18
horizontal_spacing = 0.0 , vertical_spacing = 0.0 ,
19
19
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 )' ),
22
22
scatter_options = None , ** layout_options ):
23
23
"""
24
24
Returns figure for sparkline.
@@ -39,8 +39,10 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
39
39
above their respective column
40
40
:param (str) textalign: aligns name and avg cells. Use either 'center',
41
41
'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
44
46
:param (float) alternate_row_color: set to True to enable the alternate
45
47
row coloring of the chart. Uses the colors from param 'lane_colors'
46
48
: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,
97
99
98
100
# layout options
99
101
fig ['layout' ].update (
100
- title = 'Sparkline Chart ' ,
102
+ title = '' ,
101
103
annotations = [],
102
104
showlegend = False
103
105
)
@@ -217,7 +219,7 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
217
219
218
220
if alternate_row_color :
219
221
bkgcolor = go .Scatter (
220
- x = [0 , 2 * max (df [key ])],
222
+ x = [0 , max (df [key ])],
221
223
y = [1 , 1 ],
222
224
fill = 'tozeroy' ,
223
225
mode = 'lines' ,
@@ -236,7 +238,7 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
236
238
237
239
fig ['layout' ]['yaxis{}' .format (
238
240
j * num_of_chart_types + (c + 1 )
239
- )]['range' ] = [0 , 1 ]
241
+ )]['range' ] = [0 , 1 ]
240
242
elif chart == 'line' :
241
243
trace_line = go .Scatter (
242
244
x = range (len (df [key ])),
@@ -347,6 +349,10 @@ def create_sparkline(df, chart_types=VALID_CHART_TYPES,
347
349
VALID_CHART_TYPES , 'or' )
348
350
)
349
351
)
352
+ for x_y in ['xaxis' , 'yaxis' ]:
353
+ fig ['layout' ]['{}{}' .format (
354
+ x_y , j * num_of_chart_types + (c + 1 )
355
+ )]['fixedrange' ] = True
350
356
351
357
# show titles
352
358
if show_titles :
0 commit comments