Skip to content

Commit

Permalink
Align chart form definitions, swap custom settings form with regular …
Browse files Browse the repository at this point in the history
…form view
  • Loading branch information
guerler committed Aug 19, 2016
1 parent 83e8340 commit bcc3d7f
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 330 deletions.
323 changes: 73 additions & 250 deletions config/plugins/visualizations/charts/static/charts/forms/default.js
@@ -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'
}]
}
});
@@ -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
}
}
}
});

});
});
4 changes: 2 additions & 2 deletions config/plugins/visualizations/charts/static/charts/types.js
Expand Up @@ -45,7 +45,7 @@ return Backbone.Model.extend(
// types
defaults: {
'nvd3_bar' : nvd3_bar,
'nvd3_bar_stacked' : nvd3_bar_stacked,
/*'nvd3_bar_stacked' : nvd3_bar_stacked,
'nvd3_bar_horizontal' : nvd3_bar_horizontal,
'nvd3_bar_horizontal_stacked' : nvd3_bar_horizontal_stacked,
'nvd3_line_focus' : nvd3_line_focus,
Expand All @@ -62,7 +62,7 @@ return Backbone.Model.extend(
'jqplot_scatter' : jqplot_scatter,
'jqplot_boxplot' : jqplot_boxplot,
'others_heatmap' : others_heatmap,
'others_heatmap_cluster' : others_heatmap_cluster
'others_heatmap_cluster' : others_heatmap_cluster*/
}
});

Expand Down

0 comments on commit bcc3d7f

Please sign in to comment.