Skip to content

Commit

Permalink
Made code a little more "javascripty"
Browse files Browse the repository at this point in the history
refactored the global rocketcharts variable out.
- changed the initilizers to use array and object literals.
- changed setting defaults from using "if undefined" to a "= this || this"
pattern.
- changed array[array.length] = newItem to array.push(newItem)
- renamed constructors to begin with a Capital letter.
- other small fixes - terminated unterminated lines and what not.
  • Loading branch information
luv2code committed Nov 12, 2011
1 parent a6e0297 commit b1f6df7
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 316 deletions.
5 changes: 3 additions & 2 deletions index-debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<link rel="stylesheet" href="./style/jquery.ui.all.css">

<script type="text/javascript">
var rocketcharts = new Rocketchart();
$(document).ready(function () {

// Look and feel of the chart
Expand All @@ -34,15 +35,15 @@

// User created indicator:
rocketcharts.indicators[rocketcharts.indicators.length] = {name: "Custom Indicator", id: "customindicator"};
rocketindicatorcalculations.prototype.customindicator = function (data, params, series) {
Rocketindicatorcalculations.prototype.customindicator = function (data, params, series) {
this._params = params;
this._series = series;
this._sourceData = data;
this._data = [];

if (this._series == undefined){
this._series = [];
this._series[0] = {type: rocketseries.seriesType.LINE, title: "CUSTOM", color: 0xFF0000};
this._series[0] = {type: 'line', title: "CUSTOM", color: 0xFF0000};
}

if (this._params == undefined){
Expand Down
6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="./style/jquery.ui.all.css">

<script type="text/javascript">
$(document).ready(function () {
$(document).ready(function () {

// Look and feel of the chart
var style = {};
Expand All @@ -22,15 +22,15 @@

// User created indicator:
rocketcharts.indicators[rocketcharts.indicators.length] = {name: "Custom Indicator", id: "customindicator"};
rocketindicatorcalculations.prototype.customindicator = function (data, params, series) {
Rocketindicatorcalculations.prototype.customindicator = function (data, params, series) {
this._params = params;
this._series = series;
this._sourceData = data;
this._data = [];

if (this._series == undefined){
this._series = [];
this._series[0] = {type: rocketseries.seriesType.LINE, title: "CUSTOM", color: 0xFF0000};
this._series[0] = {type: 'line', title: "CUSTOM", color: 0xFF0000};
}

if (this._params == undefined){
Expand Down
Loading

0 comments on commit b1f6df7

Please sign in to comment.