Change fields for dual_line to match with new SelectField structure (#1932)

This commit is contained in:
vera-liu 2017-01-11 10:07:30 -08:00 committed by GitHub
parent 2d866e3ffa
commit 94d20168da
2 changed files with 12 additions and 1 deletions

View File

@ -85,6 +85,9 @@ export const fields = {
choices: [],
default: [],
description: 'Choose a metric for right axis',
mapStateToProps: (state) => ({
choices: (state.datasource) ? state.datasource.metrics_combo : [],
}),
},
stacked_style: {
@ -711,7 +714,8 @@ export const fields = {
},
y_axis_2_format: {
type: 'FreeFormSelectField',
type: 'SelectField',
freeForm: true,
label: 'Right axis format',
default: '.3s',
choices: D3_TIME_FORMAT_OPTIONS,

View File

@ -1328,6 +1328,13 @@ class NVD3DualLineViz(NVD3Viz):
return df
def query_obj(self):
d = super(NVD3DualLineViz, self).query_obj()
if self.form_data.get('metric') == self.form_data.get('metric_2'):
raise Exception("Please choose different metrics"
" on left and right axis")
return d
def to_series(self, df, classed=''):
cols = []
for col in df.columns: