Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align chart form definitions, swap custom settings form with regular …
…form view
- Loading branch information
Showing
4 changed files
with
94 additions
and
330 deletions.
There are no files selected for viewing
323 changes: 73 additions & 250 deletions
323
config/plugins/visualizations/charts/static/charts/forms/default.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,259 +1,82 @@ | ||
define([], function() { | ||
|
||
return { | ||
title : '', | ||
category : '', | ||
library : '', | ||
tag : '', | ||
keywords : '', | ||
settings : { | ||
separator_x : { | ||
title : 'X axis', | ||
type : 'separator' | ||
}, | ||
x_axis_label : { | ||
title : 'Axis label', | ||
info : 'Provide a label for the axis.', | ||
var axis_label_inputs = function( prefix ) { | ||
return { | ||
name : prefix + '_axis_label', | ||
label : prefix.toUpperCase() + '-Axis label', | ||
help : 'Provide a label for the axis.', | ||
type : 'text', | ||
init : 'X-axis', | ||
value : prefix.toUpperCase() + '-axis', | ||
placeholder : 'Axis label' | ||
}, | ||
x_axis_type : { | ||
title : 'Axis value type', | ||
info : 'Select the value type of the axis.', | ||
type : 'select', | ||
init : 'auto', | ||
data : [ | ||
{ | ||
label : '-- Do not show values --', | ||
value : 'hide', | ||
operations : { | ||
hide : ['x_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Auto', | ||
value : 'auto', | ||
operations : { | ||
hide : ['x_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Float', | ||
value : 'f', | ||
operations : { | ||
show : ['x_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Exponent', | ||
value : 'e', | ||
operations : { | ||
show : ['x_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Integer', | ||
value : 'd', | ||
operations : { | ||
hide : ['x_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Percentage', | ||
value : 'p', | ||
operations : { | ||
show : ['x_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'SI-prefix', | ||
value : 's', | ||
operations : { | ||
hide : ['x_axis_precision'] | ||
} | ||
} | ||
] | ||
}, | ||
x_axis_precision : { | ||
title : 'Axis tick format', | ||
info : 'Select the tick format for the axis.', | ||
type : 'select', | ||
init : '1', | ||
data : [ | ||
{ | ||
label : '0.00001', | ||
value : '5' | ||
}, | ||
{ | ||
label : '0.0001', | ||
value : '4' | ||
}, | ||
{ | ||
label : '0.001', | ||
value : '3' | ||
}, | ||
{ | ||
label : '0.01', | ||
value : '2' | ||
}, | ||
{ | ||
label : '0.1', | ||
value : '1' | ||
}, | ||
{ | ||
label : '1', | ||
value : '0' | ||
} | ||
] | ||
} | ||
} | ||
|
||
}, | ||
separator_y : { | ||
title : 'Y axis', | ||
type : 'separator' | ||
}, | ||
y_axis_label : { | ||
title : 'Axis label', | ||
info : 'Provide a label for the axis.', | ||
type : 'text', | ||
init : 'Y-axis', | ||
placeholder : 'Axis label' | ||
}, | ||
y_axis_type : { | ||
title : 'Axis value type', | ||
info : 'Select the value type of the axis.', | ||
type : 'select', | ||
init : 'auto', | ||
data : [ | ||
{ | ||
label : '-- Do not show values --', | ||
value : 'hide', | ||
operations : { | ||
hide : ['y_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Auto', | ||
value : 'auto', | ||
operations : { | ||
hide : ['y_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Float', | ||
value : 'f', | ||
operations : { | ||
show : ['y_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Exponent', | ||
value : 'e', | ||
operations : { | ||
show : ['y_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Integer', | ||
value : 'd', | ||
operations : { | ||
hide : ['y_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'Percentage', | ||
value : 'p', | ||
operations : { | ||
show : ['y_axis_precision'] | ||
} | ||
}, | ||
{ | ||
label : 'SI-prefix', | ||
value : 's', | ||
operations : { | ||
hide : ['y_axis_precision'] | ||
} | ||
} | ||
] | ||
}, | ||
y_axis_precision : { | ||
title : 'Axis tick format', | ||
info : 'Select the tick format for the axis.', | ||
type : 'select', | ||
init : '1', | ||
data : [ | ||
{ | ||
label : '0.00001', | ||
value : '5' | ||
}, | ||
{ | ||
label : '0.0001', | ||
value : '4' | ||
}, | ||
{ | ||
label : '0.001', | ||
value : '3' | ||
}, | ||
{ | ||
label : '0.01', | ||
value : '2' | ||
}, | ||
{ | ||
label : '0.1', | ||
value : '1' | ||
}, | ||
{ | ||
label : '1', | ||
value : '0' | ||
} | ||
] | ||
var axis_precision_inputs = [ { name : 'precision', | ||
label : 'Axis tick format', | ||
help : 'Select the tick format for the axis.', | ||
type : 'select', | ||
value : '1', | ||
data : [ { label : '0.00001', value : '5' }, | ||
{ label : '0.0001', value : '4' }, | ||
{ label : '0.001', value : '3' }, | ||
{ label : '0.01', value : '2' }, | ||
{ label : '0.1', value : '1' }, | ||
{ label : '1', value : '0' } ] } ]; | ||
|
||
}, | ||
separator_legend : { | ||
title : 'Others', | ||
type : 'separator' | ||
}, | ||
show_legend : { | ||
title : 'Show legend', | ||
info : 'Would you like to add a legend?', | ||
type : 'select', | ||
display : 'radiobutton', | ||
init : 'true', | ||
data : [ | ||
{ | ||
label : 'Yes', | ||
value : 'true' | ||
}, | ||
{ | ||
label : 'No', | ||
value : 'false' | ||
} | ||
] | ||
}, | ||
use_panels : { | ||
title : 'Use multi-panels', | ||
info : 'Would you like to separate your data into individual panels?', | ||
type : 'select', | ||
display : 'radiobutton', | ||
init : 'false', | ||
data : [ | ||
{ | ||
label : 'Yes', | ||
value : 'true' | ||
}, | ||
{ | ||
label : 'No', | ||
value : 'false' | ||
} | ||
] | ||
var axis_type_inputs = function( prefix ) { | ||
return { | ||
type : 'conditional', | ||
name : prefix + '_axis_type', | ||
test_param : { | ||
name : 'type', | ||
label : prefix.toUpperCase() + '-Axis value type', | ||
type : 'select', | ||
value : 'auto', | ||
help : 'Select the value type of the axis.', | ||
data : [ { value : 'hide', label : '-- Do not show values --' }, | ||
{ value : 'auto', label : 'Auto' }, | ||
{ value : 'f', label : 'Float' }, | ||
{ value : 'd', label : 'Integer' }, | ||
{ value : 'e', label : 'Exponent' }, | ||
{ value : 'p', label : 'Percent' }, | ||
{ value : 's', label : 'SI-prefix' } ] | ||
}, | ||
cases : [ { value : 'hide' }, | ||
{ value : 'auto' }, | ||
{ value : 'f', inputs: axis_precision_inputs }, | ||
{ value : 'd' }, | ||
{ value : 'e', inputs: axis_precision_inputs }, | ||
{ value : 'p', inputs: axis_precision_inputs }, | ||
{ value : 's' } ] | ||
} | ||
}, | ||
series : [{ | ||
name : 'key', | ||
label : 'Provide a label', | ||
type : 'text', | ||
placeholder : 'Data label' | ||
}] | ||
}; | ||
} | ||
|
||
var boolean_inputs = function( name, label, help ) { | ||
return { name : name, | ||
label : label, | ||
help : help, | ||
type : 'select', | ||
display : 'radiobutton', | ||
value : 'true', | ||
data : [ { label : 'Yes', value : 'true' }, | ||
{ label : 'No', value : 'false' } ] } | ||
} | ||
|
||
return { | ||
title : '', | ||
category : '', | ||
library : '', | ||
tag : '', | ||
keywords : '', | ||
settings : [ axis_label_inputs( 'x' ), axis_type_inputs( 'x' ), | ||
axis_label_inputs( 'y' ), axis_type_inputs( 'y' ), | ||
boolean_inputs( 'show_legend', 'Show legend', 'Would you like to add a legend?' ), | ||
boolean_inputs( 'use_panels', 'Use multi-panels', 'Would you like to separate your data into individual panels?' ) ], | ||
series : [{ | ||
name : 'key', | ||
label : 'Provide a label', | ||
type : 'text', | ||
placeholder : 'Data label' | ||
}] | ||
} | ||
}); |
32 changes: 15 additions & 17 deletions
32
config/plugins/visualizations/charts/static/charts/nvd3/bar/config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
define(['plugin/charts/nvd3/common/config'], function(nvd3_config) { | ||
|
||
return $.extend(true, {}, nvd3_config, { | ||
title : 'Regular', | ||
category : 'Bar diagrams', | ||
columns : { | ||
x : { | ||
title : 'Values for x-axis', | ||
is_label : true, | ||
is_auto : true, | ||
is_unique : true | ||
}, | ||
y : { | ||
title : 'Values for y-axis', | ||
is_numeric : true | ||
return $.extend(true, {}, nvd3_config, { | ||
title : 'Regular', | ||
category : 'Bar diagrams', | ||
columns : { | ||
x : { | ||
title : 'Values for x-axis', | ||
is_label : true, | ||
is_auto : true, | ||
is_unique : true | ||
}, | ||
y : { | ||
title : 'Values for y-axis', | ||
is_numeric : true | ||
} | ||
} | ||
} | ||
}); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.