removing unnecessary code
This commit is contained in:
@@ -174,67 +174,6 @@ def all_goldmedalstandards(workouts, startdate, enddate):
|
||||
return dates, testpowers, testduration, ids
|
||||
|
||||
|
||||
def errorbar(fig, x, y, source=ColumnDataSource(),
|
||||
xerr=False, yerr=False, color='black',
|
||||
point_kwargs={}, error_kwargs={}):
|
||||
|
||||
xvalues = source.data[x]
|
||||
yvalues = source.data[y]
|
||||
|
||||
xerrvalues = source.data['xerror']
|
||||
yerrvalues = source.data['yerror']
|
||||
try:
|
||||
colorvalues = source.data['color']
|
||||
except KeyError: # pragma: no cover
|
||||
colorvalues = ["#%02x%02x%02x" % (255, 0, 0) for x in xvalues]
|
||||
|
||||
try:
|
||||
if xerr:
|
||||
x_err_x = []
|
||||
x_err_y = []
|
||||
err_color = []
|
||||
for px, py, err, color in zip(xvalues, yvalues, xerrvalues, colorvalues):
|
||||
x_err_x.append((px - err, px + err))
|
||||
x_err_y.append((py, py))
|
||||
(r, g, b) = tuple(int(color[i:i+2], 16) for i in (1, 3, 5))
|
||||
h, s, v = colorsys.rgb_to_hsv(r/255., g/255., b/255.)
|
||||
v = v*0.8
|
||||
r, g, b = colorsys.hsv_to_rgb(h, s, v)
|
||||
color2 = "#%02x%02x%02x" % (
|
||||
int(255.*r), int(255.*g), int(255*b))
|
||||
err_color.append(color2)
|
||||
|
||||
fig.multi_line(x_err_x, x_err_y, color=err_color,
|
||||
name='xerr',
|
||||
**error_kwargs)
|
||||
except TypeError: # pragma: no cover
|
||||
pass
|
||||
|
||||
try:
|
||||
if yerr:
|
||||
y_err_x = []
|
||||
y_err_y = []
|
||||
err_color = []
|
||||
for px, py, err, color in zip(xvalues, yvalues, yerrvalues, colorvalues):
|
||||
y_err_x.append((px, px))
|
||||
y_err_y.append((py - err, py + err))
|
||||
(r, g, b) = tuple(int(color[i:i+2], 16) for i in (1, 3, 5))
|
||||
h, s, v = colorsys.rgb_to_hsv(r/255., g/255., b/255.)
|
||||
v = v*0.8
|
||||
r, g, b = colorsys.hsv_to_rgb(h, s, v)
|
||||
color2 = "#%02x%02x%02x" % (
|
||||
int(255.*r), int(255.*g), int(255*b))
|
||||
err_color.append(color2)
|
||||
|
||||
fig.multi_line(y_err_x, y_err_y, color=err_color,
|
||||
name='yerr', **error_kwargs)
|
||||
except TypeError: # pragma: no cover
|
||||
pass
|
||||
|
||||
fig.circle(x, y, source=source, name='data', color=color,
|
||||
**point_kwargs)
|
||||
|
||||
|
||||
def tailwind(bearing, vwind, winddir):
|
||||
""" Calculates head-on head/tailwind in direction of rowing
|
||||
|
||||
@@ -2896,123 +2835,6 @@ def thumbnail_flex_chart(rowdata, id=0, promember=0,
|
||||
|
||||
return script, div
|
||||
|
||||
|
||||
if xparam == 'time':
|
||||
xaxmax = tseconds.max()
|
||||
xaxmin = tseconds.min()
|
||||
elif xparam == 'distance' or xparam == 'cumdist': # pragma: no cover
|
||||
xaxmax = rowdata['x1'].max()
|
||||
xaxmin = rowdata['x1'].min()
|
||||
else:
|
||||
xaxmax = yaxmaxima[xparam]
|
||||
xaxmin = yaxminima[xparam]
|
||||
|
||||
x_axis_type = 'linear'
|
||||
y_axis_type = 'linear'
|
||||
if xparam == 'time':
|
||||
x_axis_type = 'datetime'
|
||||
|
||||
if yparam1 == 'pace': # pragma: no cover
|
||||
y_axis_type = 'datetime'
|
||||
|
||||
rowdata['xname'] = axlabels[xparam]
|
||||
try:
|
||||
rowdata['yname1'] = axlabels[yparam1]
|
||||
except KeyError: # pragma: no cover
|
||||
rowdata['yname1'] = axlabels[xparam]
|
||||
if yparam2 != 'None':
|
||||
rowdata['yname2'] = axlabels[yparam2]
|
||||
else:
|
||||
rowdata['yname2'] = axlabels[yparam1]
|
||||
|
||||
# prepare data
|
||||
source = ColumnDataSource(
|
||||
rowdata
|
||||
)
|
||||
|
||||
plot = figure(x_axis_type=x_axis_type, y_axis_type=y_axis_type,
|
||||
width=200, height=150,
|
||||
)
|
||||
|
||||
|
||||
# plot.sizing_mode = 'stretch_both'
|
||||
plot.sizing_mode = 'fixed'
|
||||
plot.toolbar.logo = None
|
||||
plot.toolbar_location = None
|
||||
plot.xaxis.axis_label_text_font_size = "7pt"
|
||||
plot.yaxis.axis_label_text_font_size = "7pt"
|
||||
plot.xaxis.major_label_text_font_size = "7pt"
|
||||
plot.yaxis.major_label_text_font_size = "7pt"
|
||||
|
||||
if plottype == 'line':
|
||||
plot.line('x1', 'y1', source=source)
|
||||
elif plottype == 'scatter':
|
||||
plot.scatter('x1', 'y1', source=source, fill_alpha=0.4,
|
||||
line_color=None)
|
||||
|
||||
try:
|
||||
plot.xaxis.axis_label = axlabels[xparam]
|
||||
except KeyError: # pragma: no cover
|
||||
plot.xaxis.axis_label = 'X'
|
||||
try:
|
||||
plot.yaxis.axis_label = axlabels[yparam1]
|
||||
except KeyError: # pragma: no cover
|
||||
plot.yaxis.axis_label = 'Y'
|
||||
|
||||
try:
|
||||
yrange1 = Range1d(start=yaxminima[yparam1], end=yaxmaxima[yparam1])
|
||||
except KeyError: # pragma: no cover
|
||||
yrange1 = Range1d(start=yparam1.min(), end=yparam1.max())
|
||||
|
||||
plot.y_range = yrange1
|
||||
|
||||
if (xparam != 'time') and (xparam != 'distance') and (xparam != 'cumdist'):
|
||||
xrange1 = Range1d(start=yaxminima[xparam], end=yaxmaxima[xparam])
|
||||
plot.x_range = xrange1
|
||||
|
||||
if xparam == 'time':
|
||||
xrange1 = Range1d(start=xaxmin, end=xaxmax)
|
||||
plot.x_range = xrange1
|
||||
plot.xaxis[0].formatter = DatetimeTickFormatter(
|
||||
hours=["%H"],
|
||||
minutes=["%M"],
|
||||
seconds=["%S"],
|
||||
days=["0"],
|
||||
months=[""],
|
||||
years=[""]
|
||||
)
|
||||
|
||||
if yparam1 == 'pace': # pragma: no cover
|
||||
plot.yaxis[0].formatter = DatetimeTickFormatter(
|
||||
seconds=["%S"],
|
||||
minutes=["%M"]
|
||||
)
|
||||
|
||||
if yparam2 != 'None':
|
||||
yrange2 = Range1d(start=yaxminima[yparam2], end=yaxmaxima[yparam2])
|
||||
plot.extra_y_ranges["yax2"] = yrange2
|
||||
# = {"yax2": yrange2}
|
||||
|
||||
if plottype == 'line':
|
||||
plot.line('x1', 'y2', color="red", y_range_name="yax2",
|
||||
source=source)
|
||||
|
||||
elif plottype == 'scatter': # pragma: no cover
|
||||
plot.scatter('x1', 'y2', source=source,
|
||||
fill_alpha=0.4,
|
||||
line_color=None, color="red", y_range_name="yax2")
|
||||
|
||||
plot.add_layout(LinearAxis(y_range_name="yax2",
|
||||
axis_label=axlabels[yparam2],
|
||||
major_label_text_font_size="7pt",
|
||||
axis_label_text_font_size="7pt",
|
||||
), 'right',
|
||||
)
|
||||
|
||||
script, div = components(plot)
|
||||
|
||||
return [script, div]
|
||||
|
||||
|
||||
def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line',
|
||||
promember=0, workstrokesonly=True,
|
||||
|
||||
Reference in New Issue
Block a user