-
Notifications
You must be signed in to change notification settings - Fork 9
IPSA Directive
The spectrum renderer used in IPSA has been configured to be used as an AngularJS directive. Angular directives, read more here, allows a developer to extend Angular JavaScript functionality into HTML tags. In other words, you can integrate IPSA's interactive spectrum renderer into a custom website with a few easy steps.
First, the following files need to be included in your web page.
-
Javascript files
IPSA.js
Spectrum RendererAngular.js
Angular v1.6.5d3.vs.min.js
D3 version 3 codebased3-ease.v1.min.js
D3 transitionsd3-tip.js
Tooltip behavior -
CSS files
PeptideAnnotator.css
IPSA's custom stylingInconsolata.css
Style sheet for Inconsolata fontOpen+Sans.css
Style sheet for Open Sans fontMontserrat.css
Style sheet for Montserrat font
If you're unfamiliar with Angular syntax, I'd first suggest you check out some introductory material here.
Once the above mentioned files are included in your web page, the spectrum renderer can be included by adding the following HTML tag:
<div annotated-spectrum plotdata="myData.plotData" peptide="myData.peptide" settings="myData.settings" class="content"></div>
annotated-spectrum is the name of the directive.
plotdata is an attribute which passes the Javascript object myData.plotData to the directive.
peptide is an attribute which passes the Javascript object myData.peptide to the directive.
settings is an attribute which passes the Javascript object myData.settings to the directive.
My_Custom_Webpage.html
<html ng-app="myApp">
<head>
<!-- Javascript Dependencies -->
<script src="angular.min.js"></script>
<script src="d3.v3.min.js" charset="utf-8"></script>
<script src="d3-ease.v1.min.js"></script>
<script src="IPSA.js"></script>
<script src="d3-tip.js"></script>
<!-- CSS Dependencies -->
<link href="Montserrat.css" rel="stylesheet">
<link href="Open+Sans.css" rel="stylesheet">
<link href="Inconsolata.css" rel="stylesheet">
<link href="PeptideAnnotator.css" rel="stylesheet">
<!-- Your custom Javascript code, which provides the spectrum renderer with the spectral data and annotations -->
<script src="support/js/internal/MyCustomJavascript.js"></script>
</head>
<body>
<div ng-controller="plotCtrl">
<div annotated-spectrum plotdata="myData.plotData" peptide="myData.peptide" settings="myData.settings" class="content"></div>
</div>
</body>
</html>