Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:highslide-software/highcharts.com

  • Loading branch information...
commit a2cf934a31f3ef7f9d40cf8f7af24d2651c40112 2 parents 0e74b54 + 677e3a0
@eolsson eolsson authored
View
10 js/adapters/mootools-adapter.src.js
@@ -1,5 +1,5 @@
/**
- * @license Highcharts JS v2.1.5 (2011-06-22)
+ * @license Highcharts JS v2.1.6 (2011-07-08)
* MooTools adapter
*
* (c) 2010-2011 Torstein Hønsi
@@ -164,14 +164,6 @@ win.HighchartsAdapter = {
},
/**
- * Hyphenate a string, like minWidth becomes min-width
- * @param {Object} str
- */
- hyphenate: function (str){
- return str.hyphenate();
- },
-
- /**
* Add an event listener
* @param {Object} el HTML element or custom object
* @param {String} type Event type
View
9 js/adapters/prototype-adapter.src.js
@@ -1,5 +1,5 @@
/**
- * @license Highcharts JS v2.1.5 (2011-06-22)
+ * @license Highcharts JS v2.1.6 (2011-07-08)
* Prototype adapter
*
* @author Michael Nelson, Torstein Hønsi.
@@ -181,13 +181,6 @@ return {
return arr.findAll(fn);
},
- // change leftPadding to left-padding
- hyphenate: function(str){
- return str.replace(/([A-Z])/g, function(a, b){
- return '-' + b.toLowerCase();
- });
- },
-
// um, map
map: function(arr, fn){
return arr.map(fn);
View
19,900 js/highcharts.src.js
9,954 additions, 9,946 deletions not shown
View
2  js/modules/exporting.src.js
@@ -1,5 +1,5 @@
/**
- * @license Highcharts JS v2.1.5 (2011-06-22)
+ * @license Highcharts JS v2.1.6 (2011-07-08)
* Exporting module
*
* (c) 2010-2011 Torstein Hønsi
View
8 js/parts/Adapters.js
@@ -64,14 +64,6 @@ if (!globalAdapter && win.jQuery) {
};
/**
- * Convert a camelCase string to a hyphenated string
- * @param {String} str
- */
- hyphenate = function (str) {
- return str.replace(/([A-Z])/g, function(a, b){ return '-'+ b.toLowerCase(); });
- };
-
- /**
* Add an event listener
* @param {Object} el A HTML element or custom object
* @param {String} event The event type
View
16 js/parts/Chart.js
@@ -2106,8 +2106,7 @@ function Chart (options, callback) {
// it is too far to the left, adjust it
if (boxX < 7) {
- boxX = 7;
- boxY -= 30;
+ boxX = plotLeft + x + 15;
}
@@ -2421,9 +2420,12 @@ function Chart (options, callback) {
container.onmousedown = function(e) {
e = normalizeMouseEvent(e);
- // record the start position
- //e.preventDefault && e.preventDefault();
+ // issue #295, dragging not always working in Firefox
+ if (!hasTouch && e.preventDefault) {
+ e.preventDefault();
+ }
+ // record the start position
chart.mouseIsDown = mouseIsDown = true;
mouseDownX = e.chartX;
mouseDownY = e.chartY;
@@ -4133,10 +4135,6 @@ function Chart (options, callback) {
return;
}
- // Set to zero for each new chart
- colorCounter = 0;
- symbolCounter = 0;
-
// create the container
getContainer();
@@ -4202,7 +4200,6 @@ function Chart (options, callback) {
-
// Expose methods and variables
chart.addSeries = addSeries;
chart.animation = pick(optionsChart.animation, true);
@@ -4217,6 +4214,7 @@ function Chart (options, callback) {
chart.setTitle = setTitle;
chart.showLoading = showLoading;
chart.pointCount = 0;
+ chart.counters = new ChartCounters();
/*
if ($) $(function() {
$container = $('#container');
View
3  js/parts/Globals.js
@@ -25,8 +25,6 @@ var doc = document,
SVG_NS = 'http://www.w3.org/2000/svg',
Renderer,
hasTouch = doc.documentElement.ontouchstart !== undefined,
- colorCounter,
- symbolCounter,
symbolSizes = {},
idCounter = 0,
timeFactor = 1, // 1 = JavaScript time, 1000 = Unix time
@@ -90,7 +88,6 @@ var doc = document,
grep = adapter.grep,
map = adapter.map,
merge = adapter.merge,
- hyphenate = adapter.hyphenate,
addEvent = adapter.addEvent,
removeEvent = adapter.removeEvent,
fireEvent = adapter.fireEvent,
View
2  js/parts/Intro.js
@@ -2,7 +2,7 @@
// @compilation_level SIMPLE_OPTIMIZATIONS
/**
- * @license Highcharts JS v2.1.5 (2011-06-22)
+ * @license Highcharts JS v2.1.6 (2011-07-08)
*
* (c) 2009-2011 Torstein Hønsi
*
View
3  js/parts/Outro.js
@@ -24,6 +24,7 @@ win.Highcharts = {
merge: merge,
pick: pick,
extendClass: extendClass,
- version: '2.1.5'
+ product: 'Highcharts',
+ version: '2.1.6'
};
}());
View
21 js/parts/PieSeries.js
@@ -115,7 +115,7 @@ var PieSeries = extendClass(Series, {
*/
getColor: function() {
// record first color for use in setData
- this.initialColor = colorCounter;
+ this.initialColor = this.chart.counters.color;
},
/**
@@ -398,6 +398,11 @@ var PieSeries = extendClass(Series, {
i = 2,
j;
+ // get out if not enabled
+ if (!options.enabled) {
+ return;
+ }
+
// run parent method
Series.prototype.drawDataLabels.apply(series);
@@ -427,7 +432,8 @@ var PieSeries = extendClass(Series, {
usedSlots = [],
points = halves[i],
pos,
- length = points.length;
+ length = points.length,
+ slotIndex;
lowerHalf = i % 3;
sign = lowerHalf ? 1 : -1;
@@ -481,7 +487,6 @@ var PieSeries = extendClass(Series, {
labelPos = point.labelPos;
var closest = 9999,
- slotIndex,
distance,
slotI;
@@ -521,12 +526,12 @@ var PieSeries = extendClass(Series, {
point = points[j];
labelPos = point.labelPos;
dataLabel = point.dataLabel;
-
var slot = usedSlots.pop(),
- slotIndex = slot.i,
- naturalY = labelPos[1],
- visibility = point.visible === false ? HIDDEN : VISIBLE;
-
+ naturalY = labelPos[1];
+
+ visibility = point.visible === false ? HIDDEN : VISIBLE;
+ slotIndex = slot.i;
+
// if the slot next to currrent slot is free, the y value is allowed
// to fall back to the natural position
y = slot.y;
View
49 js/parts/Series.js
@@ -11,6 +11,7 @@ Point.prototype = {
*/
init: function(series, options) {
var point = this,
+ counters = series.chart.counters,
defaultColors;
point.series = series;
point.applyOptions(options);
@@ -21,12 +22,10 @@ Point.prototype = {
if (!point.options) {
point.options = {};
}
- point.color = point.options.color = point.color || defaultColors[colorCounter++];
+ point.color = point.options.color = point.color || defaultColors[counters.color++];
// loop back to zero
- if (colorCounter >= defaultColors.length) {
- colorCounter = 0;
- }
+ counters.wrapColor(defaultColors.length);
}
series.chart.pointCount++;
@@ -569,22 +568,19 @@ Series.prototype = {
* Get the series' color
*/
getColor: function(){
- var defaultColors = this.chart.options.colors;
- this.color = this.options.color || defaultColors[colorCounter++] || '#0000ff';
- if (colorCounter >= defaultColors.length) {
- colorCounter = 0;
- }
+ var defaultColors = this.chart.options.colors,
+ counters = this.chart.counters;
+ this.color = this.options.color || defaultColors[counters.color++] || '#0000ff';
+ counters.wrapColor(defaultColors.length);
},
/**
* Get the series' symbol
*/
getSymbol: function(){
var defaultSymbols = this.chart.options.symbols,
- symbol = this.options.marker.symbol || defaultSymbols[symbolCounter++];
- this.symbol = symbol;
- if (symbolCounter >= defaultSymbols.length) {
- symbolCounter = 0;
- }
+ counters = this.chart.counters;
+ this.symbol = this.options.marker.symbol || defaultSymbols[counters.symbol++];
+ counters.wrapSymbol(defaultSymbols.length);
},
/**
@@ -644,7 +640,7 @@ Series.prototype = {
series.xIncrement = null; // reset for new data
if (defined(initialColor)) { // reset colors for pie
- colorCounter = initialColor;
+ chart.counters.color = initialColor;
}
data = map(splat(data || []), function(pointOptions) {
@@ -1134,6 +1130,9 @@ Series.prototype = {
destroy,
prop;
+ // add event hook
+ fireEvent(series, 'destroy');
+
// remove all events
removeEvent(series);
@@ -1208,11 +1207,6 @@ Series.prototype = {
if (vAlignIsNull) {
options = merge(options, {verticalAlign: 'top'});
}
-
- // If no y delta is specified, set the default
- if (yIsNull) {
- options = merge(options, {y: -6});
- }
}
}
@@ -1241,18 +1235,24 @@ Series.prototype = {
plotX = (barX && barX + point.barW / 2) || point.plotX || -999,
plotY = pick(point.plotY, -999),
dataLabel = point.dataLabel,
- align = options.align;
-
+ align = options.align,
+ individualYDelta = yIsNull ? (point.y > 0 ? -6 : 12) : options.y;
+
// get the string
str = options.formatter.call(point.getLabelConfig());
x = (inverted ? chart.plotWidth - plotY : plotX) + options.x;
- y = (inverted ? chart.plotHeight - plotX : plotY) + options.y;
+ y = (inverted ? chart.plotHeight - plotX : plotY) + individualYDelta;
// in columns, align the string to the column
if (seriesType === 'column') {
x += { left: -1, right: 1 }[align] * point.barW / 2 || 0;
}
+ if (inverted && point.y < 0) {
+ align = 'right';
+ x -= 10;
+ }
+
// update existing label
if (dataLabel) {
// vertically centered
@@ -1490,6 +1490,9 @@ Series.prototype = {
setInvert(); // do it now
addEvent(chart, 'resize', setInvert); // do it on resize
+ addEvent(series, 'destroy', function() {
+ removeEvent(chart, 'resize', setInvert);
+ });
}
group.clip(series.clipRect)
.attr({
View
31 js/parts/SvgRenderer.js
@@ -298,15 +298,16 @@ SVGElement.prototype = {
var elemWrapper = this,
elem = elemWrapper.element,
textWidth = styles && styles.width && elem.nodeName === 'text',
- camelStyles = styles,
- n;
+ n,
+ serializedCss = '',
+ hyphenate = function(a, b){ return '-'+ b.toLowerCase(); };
// convert legacy
if (styles && styles.color) {
styles.fill = styles.color;
}
-
- // save the styles in an object
+
+ // Merge the new styles with the old ones
styles = extend(
elemWrapper.styles,
styles
@@ -316,13 +317,6 @@ SVGElement.prototype = {
// store object
elemWrapper.styles = styles;
- // hyphenate
- if (defined(styles)) {
- styles = {};
- for (n in camelStyles) {
- styles[hyphenate(n)] = camelStyles[n];
- }
- }
// serialize and set style attribute
if (isIE && !hasSVG) { // legacy IE doesn't support setting style attribute
@@ -331,8 +325,11 @@ SVGElement.prototype = {
}
css(elemWrapper.element, styles);
} else {
+ for (n in styles) {
+ serializedCss += n.replace(/([A-Z])/g, hyphenate) + ':'+ styles[n] + ';';
+ }
elemWrapper.attr({
- style: serializeCSS(styles)
+ style: serializedCss
});
}
@@ -766,11 +763,11 @@ SVGRenderer.prototype = {
hrefRegex = /href="([^"]+)"/,
parentX = attr(textNode, 'x'),
textStyles = wrapper.styles,
- reverse = isFirefox && textStyles && textStyles['-hc-direction'] === 'rtl' &&
+ reverse = isFirefox && textStyles && textStyles.HcDirection === 'rtl' &&
!this.forExport && pInt(userAgent.split('Firefox/')[1]) < 4, // issue #38
arr,
width = textStyles && pInt(textStyles.width),
- textLineHeight = textStyles && textStyles['line-height'],
+ textLineHeight = textStyles && textStyles.lineHeight,
lastLine,
GET_COMPUTED_STYLE = 'getComputedStyle',
i = childNodes.length;
@@ -842,7 +839,7 @@ SVGRenderer.prototype = {
// Webkit and opera sometimes return 'normal' as the line height. In that
// case, webkit uses offsetHeight, while Opera falls back to 18
lineHeight = win[GET_COMPUTED_STYLE] &&
- win[GET_COMPUTED_STYLE](lastLine, null).getPropertyValue('line-height');
+ pInt(win[GET_COMPUTED_STYLE](lastLine, null).getPropertyValue('line-height'));
if (!lineHeight || isNaN(lineHeight)) {
lineHeight = textLineHeight || lastLine.offsetHeight || 18;
@@ -1353,8 +1350,8 @@ SVGRenderer.prototype = {
text: str
})
.css({
- 'font-family': defaultChartStyle.fontFamily,
- 'font-size': defaultChartStyle.fontSize
+ fontFamily: defaultChartStyle.fontFamily,
+ fontSize: defaultChartStyle.fontSize
});
wrapper.x = x;
View
43 js/parts/Utilities.js
@@ -139,20 +139,7 @@ function pick() {
}
}
}
-/**
- * Make a style string from a JS object
- * @param {Object} style
- */
-function serializeCSS(style) {
- var s = '',
- key;
- // serialize the declaration
- for (key in style) {
- s += key +':'+ style[key] + ';';
- }
- return s;
-
-}
+
/**
* Set CSS on a given element
* @param {Object} el
@@ -343,3 +330,31 @@ function getPosition (el) {
}
return p;
}
+
+/**
+ * Helper class that contains variuos counters that are local to the chart.
+ */
+function ChartCounters() {
+ this.color = 0;
+ this.symbol = 0;
+}
+
+ChartCounters.prototype = {
+ /**
+ * Wraps the color counter if it reaches the specified length.
+ */
+ wrapColor: function(length) {
+ if (this.color >= length) {
+ this.color = 0;
+ }
+ },
+
+ /**
+ * Wraps the symbol counter if it reaches the specified length.
+ */
+ wrapSymbol: function(length) {
+ if (this.symbol >= length) {
+ this.symbol = 0;
+ }
+ }
+};
View
268 js/themes/dark-blue.js
@@ -0,0 +1,268 @@
+/**
+ * Dark blue theme for Highcharts JS
+ * @author Torstein Hønsi
+ */
+
+Highcharts.theme = {
+ colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
+ "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
+ chart: {
+ backgroundColor: {
+ linearGradient: [0, 0, 250, 500],
+ stops: [
+ [0, 'rgb(48, 48, 96)'],
+ [1, 'rgb(0, 0, 0)']
+ ]
+ },
+ borderColor: '#000000',
+ borderWidth: 2,
+ className: 'dark-container',
+ plotBackgroundColor: 'rgba(255, 255, 255, .1)',
+ plotBorderColor: '#CCCCCC',
+ plotBorderWidth: 1
+ },
+ title: {
+ style: {
+ color: '#C0C0C0',
+ font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
+ }
+ },
+ subtitle: {
+ style: {
+ color: '#666666',
+ font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
+ }
+ },
+ xAxis: {
+ gridLineColor: '#333333',
+ gridLineWidth: 1,
+ labels: {
+ style: {
+ color: '#A0A0A0'
+ }
+ },
+ lineColor: '#A0A0A0',
+ tickColor: '#A0A0A0',
+ title: {
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold',
+ fontSize: '12px',
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif'
+
+ }
+ }
+ },
+ yAxis: {
+ gridLineColor: '#333333',
+ labels: {
+ style: {
+ color: '#A0A0A0'
+ }
+ },
+ lineColor: '#A0A0A0',
+ minorTickInterval: null,
+ tickColor: '#A0A0A0',
+ tickWidth: 1,
+ title: {
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold',
+ fontSize: '12px',
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif'
+ }
+ }
+ },
+ legend: {
+ itemStyle: {
+ font: '9pt Trebuchet MS, Verdana, sans-serif',
+ color: '#A0A0A0'
+ }
+ },
+ tooltip: {
+ backgroundColor: 'rgba(0, 0, 0, 0.75)',
+ style: {
+ color: '#F0F0F0'
+ }
+ },
+ toolbar: {
+ itemStyle: {
+ color: 'silver'
+ }
+ },
+ plotOptions: {
+ line: {
+ dataLabels: {
+ color: '#CCC'
+ },
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ spline: {
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ scatter: {
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ candlestick: {
+ lineColor: 'white'
+ }
+ },
+ legend: {
+ itemStyle: {
+ color: '#CCC'
+ },
+ itemHoverStyle: {
+ color: '#FFF'
+ },
+ itemHiddenStyle: {
+ color: '#444'
+ }
+ },
+ credits: {
+ style: {
+ color: '#666'
+ }
+ },
+ labels: {
+ style: {
+ color: '#CCC'
+ }
+ },
+
+ navigation: {
+ buttonOptions: {
+ backgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#606060'],
+ [0.6, '#333333']
+ ]
+ },
+ borderColor: '#000000',
+ symbolStroke: '#C0C0C0',
+ hoverSymbolStroke: '#FFFFFF'
+ }
+ },
+
+ exporting: {
+ buttons: {
+ exportButton: {
+ symbolFill: '#55BE3B'
+ },
+ printButton: {
+ symbolFill: '#7797BE'
+ }
+ }
+ },
+
+ // scroll charts
+ rangeSelector: {
+ buttonTheme: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold'
+ },
+ states: {
+ hover: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#BBB'],
+ [0.6, '#888']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: 'white'
+ }
+ },
+ select: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.1, '#000'],
+ [0.3, '#333']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: 'yellow'
+ }
+ }
+ }
+ },
+ inputStyle: {
+ backgroundColor: '#333',
+ color: 'silver'
+ },
+ labelStyle: {
+ color: 'silver'
+ }
+ },
+
+ navigator: {
+ handles: {
+ backgroundColor: '#666',
+ borderColor: '#AAA'
+ },
+ outlineColor: '#CCC',
+ maskFill: 'rgba(16, 16, 16, 0.5)',
+ series: {
+ color: '#7798BF',
+ lineColor: '#A6C7ED'
+ }
+ },
+
+ scrollbar: {
+ barBackgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ barBorderColor: '#CCC',
+ buttonArrowColor: '#CCC',
+ buttonBackgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ buttonBorderColor: '#CCC',
+ rifleColor: '#FFF',
+ trackBackgroundColor: {
+ linearGradient: [0, 0, 0, 10],
+ stops: [
+ [0, '#000'],
+ [1, '#333']
+ ]
+ },
+ trackBorderColor: '#666'
+ },
+
+ // special colors for some of the
+ legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
+ legendBackgroundColorSolid: 'rgb(35, 35, 70)',
+ dataLabelsColor: '#444',
+ textColor: '#C0C0C0',
+ maskColor: 'rgba(255,255,255,0.3)'
+};
+
+// Apply the theme
+var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
View
268 js/themes/dark-green.js
@@ -0,0 +1,268 @@
+/**
+ * Dark blue theme for Highcharts JS
+ * @author Torstein Hønsi
+ */
+
+Highcharts.theme = {
+ colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
+ "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
+ chart: {
+ backgroundColor: {
+ linearGradient: [0, 0, 250, 500],
+ stops: [
+ [0, 'rgb(48, 96, 48)'],
+ [1, 'rgb(0, 0, 0)']
+ ]
+ },
+ borderColor: '#000000',
+ borderWidth: 2,
+ className: 'dark-container',
+ plotBackgroundColor: 'rgba(255, 255, 255, .1)',
+ plotBorderColor: '#CCCCCC',
+ plotBorderWidth: 1
+ },
+ title: {
+ style: {
+ color: '#C0C0C0',
+ font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
+ }
+ },
+ subtitle: {
+ style: {
+ color: '#666666',
+ font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
+ }
+ },
+ xAxis: {
+ gridLineColor: '#333333',
+ gridLineWidth: 1,
+ labels: {
+ style: {
+ color: '#A0A0A0'
+ }
+ },
+ lineColor: '#A0A0A0',
+ tickColor: '#A0A0A0',
+ title: {
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold',
+ fontSize: '12px',
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif'
+
+ }
+ }
+ },
+ yAxis: {
+ gridLineColor: '#333333',
+ labels: {
+ style: {
+ color: '#A0A0A0'
+ }
+ },
+ lineColor: '#A0A0A0',
+ minorTickInterval: null,
+ tickColor: '#A0A0A0',
+ tickWidth: 1,
+ title: {
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold',
+ fontSize: '12px',
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif'
+ }
+ }
+ },
+ legend: {
+ itemStyle: {
+ font: '9pt Trebuchet MS, Verdana, sans-serif',
+ color: '#A0A0A0'
+ }
+ },
+ tooltip: {
+ backgroundColor: 'rgba(0, 0, 0, 0.75)',
+ style: {
+ color: '#F0F0F0'
+ }
+ },
+ toolbar: {
+ itemStyle: {
+ color: 'silver'
+ }
+ },
+ plotOptions: {
+ line: {
+ dataLabels: {
+ color: '#CCC'
+ },
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ spline: {
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ scatter: {
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ candlestick: {
+ lineColor: 'white'
+ }
+ },
+ legend: {
+ itemStyle: {
+ color: '#CCC'
+ },
+ itemHoverStyle: {
+ color: '#FFF'
+ },
+ itemHiddenStyle: {
+ color: '#444'
+ }
+ },
+ credits: {
+ style: {
+ color: '#666'
+ }
+ },
+ labels: {
+ style: {
+ color: '#CCC'
+ }
+ },
+
+ navigation: {
+ buttonOptions: {
+ backgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#606060'],
+ [0.6, '#333333']
+ ]
+ },
+ borderColor: '#000000',
+ symbolStroke: '#C0C0C0',
+ hoverSymbolStroke: '#FFFFFF'
+ }
+ },
+
+ exporting: {
+ buttons: {
+ exportButton: {
+ symbolFill: '#55BE3B'
+ },
+ printButton: {
+ symbolFill: '#7797BE'
+ }
+ }
+ },
+
+ // scroll charts
+ rangeSelector: {
+ buttonTheme: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold'
+ },
+ states: {
+ hover: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#BBB'],
+ [0.6, '#888']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: 'white'
+ }
+ },
+ select: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.1, '#000'],
+ [0.3, '#333']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: 'yellow'
+ }
+ }
+ }
+ },
+ inputStyle: {
+ backgroundColor: '#333',
+ color: 'silver'
+ },
+ labelStyle: {
+ color: 'silver'
+ }
+ },
+
+ navigator: {
+ handles: {
+ backgroundColor: '#666',
+ borderColor: '#AAA'
+ },
+ outlineColor: '#CCC',
+ maskFill: 'rgba(16, 16, 16, 0.5)',
+ series: {
+ color: '#7798BF',
+ lineColor: '#A6C7ED'
+ }
+ },
+
+ scrollbar: {
+ barBackgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ barBorderColor: '#CCC',
+ buttonArrowColor: '#CCC',
+ buttonBackgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ buttonBorderColor: '#CCC',
+ rifleColor: '#FFF',
+ trackBackgroundColor: {
+ linearGradient: [0, 0, 0, 10],
+ stops: [
+ [0, '#000'],
+ [1, '#333']
+ ]
+ },
+ trackBorderColor: '#666'
+ },
+
+ // special colors for some of the
+ legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
+ legendBackgroundColorSolid: 'rgb(35, 35, 70)',
+ dataLabelsColor: '#444',
+ textColor: '#C0C0C0',
+ maskColor: 'rgba(255,255,255,0.3)'
+};
+
+// Apply the theme
+var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
View
262 js/themes/gray.js
@@ -0,0 +1,262 @@
+/**
+ * Gray theme for Highcharts JS
+ * @author Torstein Hønsi
+ */
+
+Highcharts.theme = {
+ colors: ["#DDDF0D", "#7798BF", "#55BF3B", "#DF5353", "#aaeeee", "#ff0066", "#eeaaee",
+ "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
+ chart: {
+ backgroundColor: {
+ linearGradient: [0, 0, 0, 400],
+ stops: [
+ [0, 'rgb(96, 96, 96)'],
+ [1, 'rgb(16, 16, 16)']
+ ]
+ },
+ borderWidth: 0,
+ borderRadius: 15,
+ plotBackgroundColor: null,
+ plotShadow: false,
+ plotBorderWidth: 0
+ },
+ title: {
+ style: {
+ color: '#FFF',
+ font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ },
+ subtitle: {
+ style: {
+ color: '#DDD',
+ font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ },
+ xAxis: {
+ gridLineWidth: 0,
+ lineColor: '#999',
+ tickColor: '#999',
+ labels: {
+ style: {
+ color: '#999',
+ fontWeight: 'bold'
+ }
+ },
+ title: {
+ style: {
+ color: '#AAA',
+ font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ }
+ },
+ yAxis: {
+ alternateGridColor: null,
+ minorTickInterval: null,
+ gridLineColor: 'rgba(255, 255, 255, .1)',
+ lineWidth: 0,
+ tickWidth: 0,
+ labels: {
+ style: {
+ color: '#999',
+ fontWeight: 'bold'
+ }
+ },
+ title: {
+ style: {
+ color: '#AAA',
+ font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ }
+ },
+ legend: {
+ itemStyle: {
+ color: '#CCC'
+ },
+ itemHoverStyle: {
+ color: '#FFF'
+ },
+ itemHiddenStyle: {
+ color: '#333'
+ }
+ },
+ labels: {
+ style: {
+ color: '#CCC'
+ }
+ },
+ tooltip: {
+ backgroundColor: {
+ linearGradient: [0, 0, 0, 50],
+ stops: [
+ [0, 'rgba(96, 96, 96, .8)'],
+ [1, 'rgba(16, 16, 16, .8)']
+ ]
+ },
+ borderWidth: 0,
+ style: {
+ color: '#FFF'
+ }
+ },
+
+
+ plotOptions: {
+ line: {
+ dataLabels: {
+ color: '#CCC'
+ },
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ spline: {
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ scatter: {
+ marker: {
+ lineColor: '#333'
+ }
+ },
+ candlestick: {
+ lineColor: 'white'
+ }
+ },
+
+ toolbar: {
+ itemStyle: {
+ color: '#CCC'
+ }
+ },
+
+ navigation: {
+ buttonOptions: {
+ backgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#606060'],
+ [0.6, '#333333']
+ ]
+ },
+ borderColor: '#000000',
+ symbolStroke: '#C0C0C0',
+ hoverSymbolStroke: '#FFFFFF'
+ }
+ },
+
+ exporting: {
+ buttons: {
+ exportButton: {
+ symbolFill: '#55BE3B'
+ },
+ printButton: {
+ symbolFill: '#7797BE'
+ }
+ }
+ },
+
+ // scroll charts
+ rangeSelector: {
+ buttonTheme: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: '#CCC',
+ fontWeight: 'bold'
+ },
+ states: {
+ hover: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#BBB'],
+ [0.6, '#888']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: 'white'
+ }
+ },
+ select: {
+ fill: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.1, '#000'],
+ [0.3, '#333']
+ ]
+ },
+ stroke: '#000000',
+ style: {
+ color: 'yellow'
+ }
+ }
+ }
+ },
+ inputStyle: {
+ backgroundColor: '#333',
+ color: 'silver'
+ },
+ labelStyle: {
+ color: 'silver'
+ }
+ },
+
+ navigator: {
+ handles: {
+ backgroundColor: '#666',
+ borderColor: '#AAA'
+ },
+ outlineColor: '#CCC',
+ maskFill: 'rgba(16, 16, 16, 0.5)',
+ series: {
+ color: '#7798BF',
+ lineColor: '#A6C7ED'
+ }
+ },
+
+ scrollbar: {
+ barBackgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ barBorderColor: '#CCC',
+ buttonArrowColor: '#CCC',
+ buttonBackgroundColor: {
+ linearGradient: [0, 0, 0, 20],
+ stops: [
+ [0.4, '#888'],
+ [0.6, '#555']
+ ]
+ },
+ buttonBorderColor: '#CCC',
+ rifleColor: '#FFF',
+ trackBackgroundColor: {
+ linearGradient: [0, 0, 0, 10],
+ stops: [
+ [0, '#000'],
+ [1, '#333']
+ ]
+ },
+ trackBorderColor: '#666'
+ },
+
+ // special colors for some of the demo examples
+ legendBackgroundColor: 'rgba(48, 48, 48, 0.8)',
+ legendBackgroundColorSolid: 'rgb(70, 70, 70)',
+ dataLabelsColor: '#444',
+ textColor: '#E0E0E0',
+ maskColor: 'rgba(255,255,255,0.3)'
+};
+
+// Apply the theme
+var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
View
97 js/themes/grid.js
@@ -0,0 +1,97 @@
+/**
+ * Grid theme for Highcharts JS
+ * @author Torstein Hønsi
+ */
+
+Highcharts.theme = {
+ colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
+ chart: {
+ backgroundColor: {
+ linearGradient: [0, 0, 500, 500],
+ stops: [
+ [0, 'rgb(255, 255, 255)'],
+ [1, 'rgb(240, 240, 255)']
+ ]
+ }
+,
+ borderWidth: 2,
+ plotBackgroundColor: 'rgba(255, 255, 255, .9)',
+ plotShadow: true,
+ plotBorderWidth: 1
+ },
+ title: {
+ style: {
+ color: '#000',
+ font: 'bold 16px "Trebuchet MS", Verdana, sans-serif'
+ }
+ },
+ subtitle: {
+ style: {
+ color: '#666666',
+ font: 'bold 12px "Trebuchet MS", Verdana, sans-serif'
+ }
+ },
+ xAxis: {
+ gridLineWidth: 1,
+ lineColor: '#000',
+ tickColor: '#000',
+ labels: {
+ style: {
+ color: '#000',
+ font: '11px Trebuchet MS, Verdana, sans-serif'
+ }
+ },
+ title: {
+ style: {
+ color: '#333',
+ fontWeight: 'bold',
+ fontSize: '12px',
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif'
+
+ }
+ }
+ },
+ yAxis: {
+ minorTickInterval: 'auto',
+ lineColor: '#000',
+ lineWidth: 1,
+ tickWidth: 1,
+ tickColor: '#000',
+ labels: {
+ style: {
+ color: '#000',
+ font: '11px Trebuchet MS, Verdana, sans-serif'
+ }
+ },
+ title: {
+ style: {
+ color: '#333',
+ fontWeight: 'bold',
+ fontSize: '12px',
+ fontFamily: 'Trebuchet MS, Verdana, sans-serif'
+ }
+ }
+ },
+ legend: {
+ itemStyle: {
+ font: '9pt Trebuchet MS, Verdana, sans-serif',
+ color: 'black'
+
+ },
+ itemHoverStyle: {
+ color: '#039'
+ },
+ itemHiddenStyle: {
+ color: 'gray'
+ }
+ },
+ labels: {
+ style: {
+ color: '#99b'
+ }
+ }
+};
+
+// Apply the theme
+var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
+
View
89 js/themes/skies.js
@@ -0,0 +1,89 @@
+/**
+ * Skies theme for Highcharts JS
+ * @author Torstein Hønsi
+ */
+
+Highcharts.theme = {
+ colors: ["#514F78", "#42A07B", "#9B5E4A", "#72727F", "#1F949A", "#82914E", "#86777F", "#42A07B"],
+ chart: {
+ className: 'skies',
+ borderWidth: 0,
+ plotShadow: true,
+ plotBackgroundImage: '/demo/gfx/skies.jpg',
+ plotBackgroundColor: {
+ linearGradient: [0, 0, 250, 500],
+ stops: [
+ [0, 'rgba(255, 255, 255, 1)'],
+ [1, 'rgba(255, 255, 255, 0)']
+ ]
+ },
+ plotBorderWidth: 1
+ },
+ title: {
+ style: {
+ color: '#3E576F',
+ font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ },
+ subtitle: {
+ style: {
+ color: '#6D869F',
+ font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ },
+ xAxis: {
+ gridLineWidth: 0,
+ lineColor: '#C0D0E0',
+ tickColor: '#C0D0E0',
+ labels: {
+ style: {
+ color: '#666',
+ fontWeight: 'bold'
+ }
+ },
+ title: {
+ style: {
+ color: '#666',
+ font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ }
+ },
+ yAxis: {
+ alternateGridColor: 'rgba(255, 255, 255, .5)',
+ lineColor: '#C0D0E0',
+ tickColor: '#C0D0E0',
+ tickWidth: 1,
+ labels: {
+ style: {
+ color: '#666',
+ fontWeight: 'bold'
+ }
+ },
+ title: {
+ style: {
+ color: '#666',
+ font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
+ }
+ }
+ },
+ legend: {
+ itemStyle: {
+ font: '9pt Trebuchet MS, Verdana, sans-serif',
+ color: '#3E576F'
+ },
+ itemHoverStyle: {
+ color: 'black'
+ },
+ itemHiddenStyle: {
+ color: 'silver'
+ }
+ },
+ labels: {
+ style: {
+ color: '#3E576F'
+ }
+ }
+};
+
+// Apply the theme
+var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
View
1  test/jsTestDriver.conf
@@ -29,3 +29,4 @@ load:
- test/unit/ColorTest.js
- test/unit/UtilitiesTest.js
- test/unit/AdaptersTest.js
+ - test/unit/RendererTest.js
View
1  test/jsTestDriverCoverage.conf
@@ -29,6 +29,7 @@ load:
- test/unit/ColorTest.js
- test/unit/UtilitiesTest.js
- test/unit/AdaptersTest.js
+ - test/unit/RendererTest.js
plugin:
- name: "coverage"
View
49 test/unit/RendererTest.js
@@ -0,0 +1,49 @@
+RendererTest = TestCase("RendererTest");
+
+/**
+ * Setup:
+ * - Creates the container div object on the page.
+ * - Creates a renderer instance.
+ */
+RendererTest.prototype.setUp = function() {
+ assertUndefined(this.container);
+ /*:DOC container = <div style="height: 200px; width: 200px"></div>*/
+ assertNotUndefined(this.container);
+
+ this.renderer = new Renderer(this.container, 200, 200);
+ assertNotUndefined(this.renderer);
+}
+
+/**
+ * Test that css attributes are merged together.
+ */
+RendererTest.prototype.testCssFontSize = function () {
+ var textElement = this.renderer.text('Hello World', 100, 90),
+ undefinedFontSize = 'font-size',
+ definedFontSize = 'fontSize',
+ defaultFontSize = defaultOptions.chart.style.fontSize;
+
+ assertNotUndefined(textElement);
+ assertEquals('x value', 100, textElement.x);
+ assertEquals('y value', 90, textElement.y);
+
+ // Before css the font size should be the default (12px)
+ assertUndefined(undefinedFontSize + ' should be undefined', textElement.styles[undefinedFontSize])
+ assertEquals('Default font size', defaultFontSize, textElement.styles[definedFontSize]);
+
+ // Apply a new font size
+ textElement.css({
+ fontSize: '21px'
+ });
+
+ assertUndefined(undefinedFontSize + ' should be undefined', textElement.styles[undefinedFontSize])
+ assertEquals('Changed font size', '21px', textElement.styles[definedFontSize]);
+
+ // Apply a color and make sure the font size stays the same
+ textElement.css({
+ color: 'red'
+ });
+
+ assertUndefined(undefinedFontSize + ' should be undefined', textElement.styles[undefinedFontSize])
+ assertEquals('Changed font size', '21px', textElement.styles[definedFontSize]);
+}
Please sign in to comment.
Something went wrong with that request. Please try again.