-
Notifications
You must be signed in to change notification settings - Fork 967
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
15,280 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "galaxy-charts-plugins", | ||
"version": "0.1.0", | ||
"description": "Charts visualization plugin.", | ||
"keywords": [ | ||
"galaxy", | ||
"visualization", | ||
"d3" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/guerler/galaxy-charts" | ||
}, | ||
"license": "AFL-3.0", | ||
"dependencies": { | ||
"amdi18n-loader": "^0.2.0", | ||
"grunt": "^0.4.5", | ||
"grunt-bower-install-simple": "^1.1.0", | ||
"grunt-check-modules": "^1.0.0", | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-clean": "^0.6.0", | ||
"grunt-contrib-copy": "^0.5.0", | ||
"grunt-contrib-less": "^1.1.0", | ||
"grunt-contrib-uglify": "^0.8.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-exec": "^0.4.6", | ||
"grunt-spritesmith": "^4.7.1", | ||
"i18n-webpack-plugin": "^0.2.7", | ||
"webpack": "^1.10.1", | ||
"webpack-dev-server": "^1.7.0", | ||
"backbone": "^1.3.3", | ||
"bootstrap": "^3.3.7", | ||
"cytoscape": "^2.7.10", | ||
"jquery": "^3.1.1", | ||
"cytoscape-edgehandles": "^2.6.0" | ||
}, | ||
"devDependencies": { | ||
"css-loader": "^0.24.0", | ||
"style-loader": "^0.13.1" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** This is the common wrapper for nvd3 based visualizations. */ | ||
define( [ 'utilities/tabular-utilities', 'plugin/nv.d3', 'style!css!plugin/nv.d3.css' ], function( Utilities ) { | ||
var CommonWrapper = Backbone.View.extend({ | ||
initialize: function( options ) { | ||
var self = this; | ||
this.options = options; | ||
options.render = function( canvas_id, groups ) { | ||
return self.render( canvas_id, groups ) | ||
}; | ||
Utilities.panelHelper( options ); | ||
}, | ||
render: function( canvas_id, groups ) { | ||
var self = this; | ||
var chart = this.options.chart; | ||
var type = this.options.type; | ||
var makeConfig = this.options.makeConfig; | ||
var d3chart = nv.models[ type ](); | ||
nv.addGraph( function() { | ||
try { | ||
d3chart.xAxis.axisLabel( chart.settings.get( 'x_axis_label' ) ); | ||
d3chart.yAxis.axisLabel( chart.settings.get( 'y_axis_label' ) ).axisLabelDistance( 30 ); | ||
d3chart.options( { showControls: false } ); | ||
d3chart.showLegend && d3chart.showLegend(chart.settings.get('show_legend') == 'true'); | ||
self._makeAxes( d3chart, groups, chart.settings ); | ||
makeConfig && makeConfig( d3chart ); | ||
chart.settings.get( '__use_panels' ) === 'true' && d3chart.options( { showControls: false } ); | ||
d3chart.xAxis.showMaxMin( false ); | ||
d3chart.yAxis.showMaxMin( chart.definition.showmaxmin ); | ||
d3chart.tooltipContent( function( key, x, y, graph ) { | ||
return '<h3>' + ( graph.point.tooltip || key ) + '</h3>'; | ||
}); | ||
if ( $( '#' + canvas_id ).length > 0 ) { | ||
var canvas = d3.select( '#' + canvas_id ); | ||
canvas.datum( groups ).call( d3chart ); | ||
if ( chart.definition.zoomable && chart.definition.zoomable != 'native' ) { | ||
d3chart.clipEdge && d3chart.clipEdge( true ); | ||
Utilities.addZoom({ | ||
xAxis : d3chart.xAxis, | ||
yAxis : d3chart.yAxis, | ||
yDomain: d3chart.yDomain, | ||
xDomain: d3chart.xDomain, | ||
redraw : function() { d3chart.update() }, | ||
svg : canvas | ||
}); | ||
} | ||
nv.utils.windowResize( d3chart.update ); | ||
} | ||
} catch ( err ) { | ||
chart.state( 'failed', err ); | ||
} | ||
}); | ||
return true; | ||
}, | ||
|
||
/** Format axes ticks */ | ||
_makeAxes: function( d3chart, groups, settings ) { | ||
var categories = Utilities.makeCategories( groups, [ 'x', 'y' ] ); | ||
function makeTickFormat( id ) { | ||
Utilities.makeTickFormat({ | ||
categories : categories.array[ id ], | ||
type : settings.get( id + '_axis_type|type' ), | ||
precision : settings.get( id + '_axis_type|precision' ), | ||
formatter : function( formatter ) { | ||
formatter && d3chart[ id + 'Axis' ].tickFormat( function( value ) { | ||
return formatter( value ); | ||
}); | ||
} | ||
}); | ||
}; | ||
makeTickFormat( 'x' ); | ||
makeTickFormat( 'y' ); | ||
} | ||
}); | ||
|
||
return { | ||
nvd3_bar: function(options) { | ||
options.type = 'multiBarChart'; | ||
new CommonWrapper( options ); | ||
} | ||
} | ||
}); |
Oops, something went wrong.