I am using Highcharts to show BoxPlot Chart.
Here is an example of this chart: http://jsfiddle.net/tLucL6mq/3/.
$('#container').highcharts({
chart: {
type: 'boxplot',
inverted: true
},
title: {
text: 'Sample Base Salary Range'
},
legend: {
enabled: false
},
xAxis: {
categories: ['4', '3', '2', '1', '0'],
title: {
text: 'Job Level'
}
},
yAxis: {
title: {
text: 'Base Salary'
}
},
plotOptions: {
boxplot: {
fillColor: '#F0F0E0',
lineWidth: 2,
medianColor: '#0C5DA5',
medianWidth: 3
}
},
series: [{
name: "Observation Data",
data: [
['0', 68, 75, 79, 82, 84, 89], //level 4 - category 0
['1', 53, 63, 68, 72, 75, 79], //level 3 - category 1
['2', 47, 52, 59, 64, 67, 68], //level 2 - category 2
['3', 35, 37, 39, 42, 46, 51], //level 1 - category 3
['4', 32, 33, 34, 38, 40, 45] //level 0 - category 4
],
tooltip: {
headerFormat: '<b>{point.series.name}</b><br/><em>Job Level: {point.x}</em><br/>',
pointFormat: '- Max: {point.high}<br/>' +
'- Q3: {point.q3}<br/>' +
'- Median: {point.median}<br/>' +
'- Q1: {point.q1}<br/>' +
'- Min: {point.low}<br/>'
}
}]
});
I want to add border radius, but I did not find this option.
I try to add it in a lot of positions. But no succees.
Any help?
Border radius is not supported by default in Highcharts boxplot series. The element, which you want to modify is a path, so it can not be done in a simple way.
However, by using Highcharts.SVGRenderer you can replace the path element by a rect with border radius, example:
events: {
render: function() {
var points = this.series[0].points,
pathBBox,
path;
Highcharts.each(points, function(p) {
path = p.graphic.element.children[2];
pathBBox = path.getBBox();
if (!p.additionalElement) {
p.additionalElement = this.renderer.rect(pathBBox.x + this.plotLeft, pathBBox.y + this.plotTop, pathBBox.width, pathBBox.height, 5)
.attr({
stroke: '#7cb5ec',
'stroke-width': 1,
zIndex: 4
})
.add();
} else {
p.additionalElement.attr({
x: pathBBox.x + this.plotLeft,
y: pathBBox.y + this.plotTop,
width: pathBBox.width,
height: pathBBox.height
});
}
path.setAttribute('stroke', 'transparent');
}, this);
}
}
Live demo: http://jsfiddle.net/BlackLabel/y9umo52w/
If this helps, you can also directly set the attribute 'd' of the current graphic.
function roundCornerBox(pathBBox: { x: number; y: number; width: number; height: number;}, radius: number) {
const { x, y, width, height } = pathBBox;
const eightPoints = [
{ x, y: y + radius },
{ x: x + radius, y },
{ x: x - radius + width, y },
{ x: x + width, y: y + radius },
{ x: x + width, y: y + height - radius },
{ x: x + width - radius, y: y + height },
{ x: x + radius, y: y + height },
{ x, y: y + height - radius }
];
const controlPoints = [
{ x, y },
{ x: x + width, y },
{ x: x + width, y: y + height },
{ x, y: y + height }
];
let controlPointIndex = 0,
lastCommand = 'Q',
controlPoint = controlPoints[0];
let d = '';
eightPoints.forEach((point, index) => {
if (index === 0) {
d += `M ${point.x} ${point.y} `;
return;
}
if (lastCommand === 'Q') {
controlPoint = controlPoints[controlPointIndex];
d += `${lastCommand} ${controlPoint.x} ${controlPoint.y} ${point.x} ${point.y}`;
lastCommand = 'L';
controlPointIndex++;
} else {
d += `${lastCommand} ${point.x} ${point.y} `;
lastCommand = 'Q';
}
});
d += 'z';
return d;
};
events: {
render: function() {
var points = this.series[0].points,
pathBBox,
path;
var radius = 5;
Highcharts.each(points, function(p) {
path = p.graphic.element.children[2];
pathBBox = path.getBBox();
path.setAttribute('d', roundCornerBox(pathBBox, radius));
}, this);
}
}
Related
I have a chart like this example, and I want to merge vertically some of the first column's cells. in this example, I want to merge the 0, 1, 2 cells in the first column.
How is it possible?
Code of the example:
yAxis: {
type: 'category',
grid: {
borderColor: '#3a5d96',
columns: [{
title: {
text: 'Tasks',
rotation: 45,
y: -15,
x: -15
}
}, {
title: {
text: 'Assignee',
rotation: 45,
y: -15,
x: -15
},
labels: {
format: '{point.assignee}'
}
}, {
title: {
text: 'Duration',
rotation: 45,
y: -15,
x: -15
},
labels: {
formatter: function() {
var point = this.point,
days = (1000 * 60 * 60 * 24),
number = (point.end - point.start) / days;
return Math.round(number * 100) / 100;
}
}
}]
}
}
I am afraid that vertically merging options doesn't exist for the columns treegrid in the Highcharts Gantt, however you can hide those paths between the labels.
Demo: https://jsfiddle.net/BlackLabel/va1fqwd5/
chart: {
events: {
load() {
let chart = this,
ticks = chart.yAxis[0].treeGrid.axis.grid.columns[1].ticks;
ticks[0].mark.hide();
ticks[1].mark.hide();
ticks[2].mark.hide();
}
}
},
I am using the Organization Chart and want to change the start of a line to be from a different place of the node. An example fiddle is at https://jsfiddle.net/markjjordan/oL19jfwv/70/.
The source code is as follows:
var nodes = [
{
id: '001.b001.b004',
//column: 1,
//width: 200,
offset: '-30%',
}
,
{
id: '001.b001.b003',
//column: 2,
//width: 200,
offset: '-30%',
}
,
{
id: '001.b001.b002',
//column: 3,
//width: 200,
offset: '-30%',
}
,
{
id: '001.b001.b001.b004',
//column: 4,
//width: 200,
offset: '-15%',
}
,
{
id: '001.b001.b001.b003',
//column: 5,
//width: 200,
offset: '-15%',
}
,
{
id: '001.b001.b001.b002',
//column: 6,
//width: 200,
offset: '-15%',
}
,
{
id: '001.b001.b001.b001',
//column: 7,
//width: 200,
offset: '-15%',
}
,
{
id: '001.b001.b001',
//column: 8,
//width: 200,
offset: '-30%',
}
,
{
id: '001.b001.b005',
//column: 0,
//width: 200,
offset: '-30%',
}
,
{
id: '001.b001',
//column: 9,
//width: 200,
offset: '-45%',
}
,
{
id: '001',
//column: 10,
//width: 200,
offset: '-60%',
color: 'orange'
}
,
{
id: '001.001',
//column: 11,
//width: 200,
offset: '-45%',
}
,
{
id: '001.001.005',
//column: 12,
//width: 200,
offset: '-30%',
}
,
{
id: '001.001.001',
//column: 13,
//width: 200,
offset: '-30%',
}
,
{
id: '001.001.001.001',
//width: 200,
//column: 14,
offset: '-15%',
}
,
{
id: '001.001.001.002',
//width: 200,
//column: 15,
offset: '-15%',
}
,
{
id: '001.001.001.003',
//width: 200,
//column: 16,
offset: '-15%',
}
,
{
id: '001.001.001.004',
//width: 200,
//column: 17,
offset: '-15%',
}
,
{
id: '001.001.002',
//width: 200,
//column: 18,
offset: '-30%',
}
,
{
id: '001.001.003',
//width: 200,
//column: 19,
offset: '-30%',
}
,
{
id: '001.001.004',
//width: 200,
//column: 20,
offset: '-30%',
}
]
;
var counter = 0;
nodes.forEach(function(element) {
//console.log(element);
element.width = 200;
element.column = counter++;
});
Highcharts.chart('container', {
chart: {
height: 2000,
//width: 800,
inverted: true
},
title: {
text: 'Highcharts Org Chart'
},
series: [{
type: 'organization',
name: 'Highsoft',
keys: ['from', 'to'],
nodePadding: 5,
hangingIndent: 10,
data: [
['001', '001.001'],
['001.001', '001.001.005'],
['001.001', '001.001.001'],
['001.001.001', '001.001.001.001'],
['001.001.001', '001.001.001.002'],
['001.001.001', '001.001.001.003'],
['001.001.001', '001.001.001.004'],
['001.001', '001.001.002'],
['001.001', '001.001.003'],
['001.001', '001.001.004'],
['001', '001.b001'],
['001.b001', '001.b001.b001'],
['001.b001.b001', '001.b001.b001.b001'],
['001.b001.b001', '001.b001.b001.b002'],
['001.b001.b001', '001.b001.b001.b003'],
['001.b001.b001', '001.b001.b001.b004'],
['001.b001', '001.b001.b002'],
['001.b001', '001.b001.b003'],
['001.b001', '001.b001.b004'],
['001.b001', '001.b001.b005'],
],
nodes: nodes,
colorByPoint: false,
color: '#007ad0',
dataLabels: {
color: 'white'
},
borderColor: 'white',
nodeWidth: 65
}],
tooltip: {
outside: true
},
exporting: {
allowHTML: true,
sourceWidth: 800,
sourceHeight: 600
}
});
All blue nodes above the orange one have a "from" reference for the orange node and a "to" reference for the blue node in the data parameter of HighCharts… I needed to do this because I want everything above the orange node to have multiple parents.
What I'd like as far as the lines go is to have lines coming from or to a blue node to be on the left side instead of the top or bottom as in the jsfiddle.
You can achieve it simply by wrapping the Highcharts.seriesTypes.organization.prototype.translateLink method and changing the way links path is created. I've prepared an example for you where a new layout = "custom" is added.
Code:
(function(H) {
H.seriesTypes.organization.prototype.translateLink = function(point) {
var fromNode = point.fromNode,
toNode = point.toNode,
series = point.series,
layout = toNode.layout,
crisp = Math.round(this.options.linkLineWidth) % 2 / 2,
x1 = Math.floor(
fromNode.shapeArgs.x + fromNode.shapeArgs.width
) + crisp,
y1 = Math.floor(
fromNode.shapeArgs.y + fromNode.shapeArgs.height / 2
) + crisp,
x2 = Math.floor(toNode.shapeArgs.x) + crisp,
y2 = Math.floor(
toNode.shapeArgs.y + toNode.shapeArgs.height / 2
) + crisp,
xMiddle,
hangingIndent = this.options.hangingIndent,
toOffset = toNode.options.offset,
percentOffset = /%$/.test(toOffset) && parseInt(toOffset, 10),
inverted = this.chart.inverted,
isEven = fromNode.linksFrom.length % 2 === 0,
lastToNodeId =
fromNode.linksFrom[fromNode.linksFrom.length - 1].to,
linkBranchOffset = H.defined(fromNode.linkBranchOffset) ?
fromNode.linkBranchOffset : undefined,
prevOffset = 'prevLinkBranchOffset' + fromNode.column,
middleNode1,
middleNode2,
directionIndicator,
linkDirection,
linkCorrection,
branchOffset,
d;
if (inverted) {
x1 -= fromNode.shapeArgs.width;
x2 += toNode.shapeArgs.width;
}
xMiddle = Math.floor(
x2 +
(inverted ? 1 : -1) *
(this.colDistance - this.nodeWidth) / 2
) + crisp;
// Put the link on the side of the node when an offset is given. HR
// node in the main demo.
if (
percentOffset &&
(percentOffset >= 50 || percentOffset <= -50)
) {
xMiddle = x2 = Math.floor(
x2 + (inverted ? -0.5 : 0.5) * toNode.shapeArgs.width
) + crisp;
y2 = toNode.shapeArgs.y;
if (percentOffset > 0) {
y2 += toNode.shapeArgs.height;
}
}
if (toNode.hangsFrom === fromNode) {
if (this.chart.inverted) {
y1 = Math.floor(
fromNode.shapeArgs.y +
fromNode.shapeArgs.height -
hangingIndent / 2
) + crisp;
y2 = toNode.shapeArgs.y + toNode.shapeArgs.height;
} else {
y1 = Math.floor(
fromNode.shapeArgs.y +
hangingIndent / 2
) + crisp;
}
xMiddle = x2 = Math.floor(
toNode.shapeArgs.x + toNode.shapeArgs.width / 2
) + crisp;
}
if (layout === 'custom') {
d = this.curvedPath([
[x1, y1],
[xMiddle - toNode.nodeHeight / 2 - 10, y1],
[xMiddle - toNode.nodeHeight / 2 - 10, y2]
], this.options.linkRadius);
} else {
d = this.curvedPath([
[x1, y1],
[xMiddle, y1],
[xMiddle, y2],
[x2, y2]
], this.options.linkRadius);
}
point.plotY = 1;
point.shapeType = 'path';
point.shapeArgs = {
d: d
};
}
})(Highcharts)
Demo: (open on screen width > 800px)
https://jsfiddle.net/BlackLabel/02raLmuo/
We are developing some charts using Highcharts.
And we are using the series.events.afterAnimate in combination with an xAxis.max value.
But when we have for example points from Januari until September, but with an xAxis.max value until December the afterAnimate function is called when it reached December we guess..
But we would like have a callback when all the valid points are drawn, and not we it reaches its max value...
is this possible?
That happens because the clipPath width is by default equal width of the plot area. To change it you can overwrite Highcharts.Series.animate method and set clipPath width equal width of the particular series.
EDIT:
Also, note that when the width of the clipPath is shorter and the duration of the animation is the same the animation will be much slower. To make it look better the time has to be shortened - it can be calculated depending on series width and updated in chart load event.
Check demo and code posted below:
Code:
(function(H) {
H.Series.prototype.animate = function(init) {
var series = this,
chart = series.chart,
clipRect,
animation = H.animObject(series.options.animation),
sharedClipKey;
// Initialize the animation. Set up the clipping rectangle.
if (init) {
series.setClip(animation);
// Run the animation
} else {
sharedClipKey = this.sharedClipKey;
clipRect = chart[sharedClipKey];
if (clipRect) {
clipRect.animate({
width: series.group.getBBox().width,
x: 0
}, animation);
}
if (chart[sharedClipKey + 'm']) {
chart[sharedClipKey + 'm'].animate({
width: chart.plotSizeX + 99,
x: 0
}, animation);
}
// Delete this function to allow it only once
series.animate = null;
}
}
})(Highcharts);
Highcharts.setOptions({
chart: {
events: {
load: function() {
var chart = this,
series = chart.series[0],
seriesWidth = series.graph.getBBox().width,
duration = (seriesWidth / chart.plotWidth) * series.options.animation.duration;
chart.series[0].update({
animation: {
duration: duration
}
});
}
}
},
plotOptions: {
series: {
animation: {
duration: 2000
}
}
}
});
Highcharts.chart('container', {
title: {
text: 'Chart with half data but with max data'
},
subtitle: {
text: 'A label should appear when all points are drawn'
},
xAxis: {
type: 'datetime',
min: Date.UTC(2019, 0, 1),
max: Date.UTC(2019, 11, 31),
tickInterval: 2592000000, // month
},
plotOptions: {
series: {
events: {
afterAnimate: function() {
this.chart.renderer.label(this.name + ' has appeared', 100, 70)
.attr({
padding: 10,
fill: Highcharts.getOptions().colors[0]
})
.css({
color: 'white'
})
.add();
}
}
}
},
series: [{
data: [{
x: Date.UTC(2019, 0, 1),
y: 29.9
},
{
x: Date.UTC(2019, 1, 1),
y: 139.9
},
{
x: Date.UTC(2019, 2, 1),
y: 59.9
},
{
x: Date.UTC(2019, 3, 1),
y: 19.9
},
]
}]
});
Highcharts.chart('container2', {
title: {
text: 'Chart with full data'
},
subtitle: {
text: 'A label should appear on the plot area after animate'
},
xAxis: {
type: 'datetime',
min: Date.UTC(2019, 0, 1),
max: Date.UTC(2019, 11, 31),
tickInterval: 2592000000, // month
},
plotOptions: {
series: {
events: {
afterAnimate: function() {
this.chart.renderer.label(this.name + ' has appeared', 100, 70)
.attr({
padding: 10,
fill: Highcharts.getOptions().colors[0]
})
.css({
color: 'white'
})
.add();
}
}
}
},
series: [{
data: [{
x: Date.UTC(2019, 0, 1),
y: 29.9
},
{
x: Date.UTC(2019, 1, 1),
y: 139.9
},
{
x: Date.UTC(2019, 2, 1),
y: 59.9
},
{
x: Date.UTC(2019, 3, 1),
y: 19.9
},
{
x: Date.UTC(2019, 4, 1),
y: 29.9
},
{
x: Date.UTC(2019, 5, 1),
y: 139.9
},
{
x: Date.UTC(2019, 6, 1),
y: 59.9
},
{
x: Date.UTC(2019, 7, 1),
y: 19.9
},
{
x: Date.UTC(2019, 8, 1),
y: 29.9
},
{
x: Date.UTC(2019, 9, 1),
y: 139.9
},
{
x: Date.UTC(2019, 10, 1),
y: 59.9
},
{
x: Date.UTC(2019, 11, 1),
y: 19.9
},
]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
<div id="container2" style="height: 400px"></div>
Demo:
https://jsfiddle.net/BlackLabel/gj7eqkv8/
API reference:
https://api.highcharts.com/highcharts/chart.events.load
I am trying to add 'Page number x of y' to a PDF generated using jspdf and jspdf-autotable. I have used the code from the examples.js file on jspdf-autotable example site and also used the jspdf.debug.js file from this website which contains the putTotalPages function in.
The result I am getting on each page is 'Page 1 of {total_pages_count_string}' on first page and 'Page 2 of {total_pages_count_string}' on second page i.e. the total_pages_count_string does not appear to be updating correctly.
My entire code is as follows:
$('#print').click(function() {
$('#html-table table').remove();
var table = $("#amu-whiteboard").tabulator("getHtml");
$('#html-table').append(table);
$('#html-table>table').attr("id", "table");
$('#table th:not(:nth-child(1), :nth-child(2)), #table td:not(:nth-child(1), :nth-child(2))').remove();
var columns = ["Bed", "Name", "Diagnoses", "Jobs"];
var doc = new jsPDF('l', 'pt');
doc.setFont('Helvetica', 'normal');
doc.setTextColor(40);
var dateTime = moment().format('HH:mm on MMMM Do, YYYY');
var printedOn = "Printed at " + dateTime;
var totalPagesExp = "{total_pages_count_string}";
var pageContent = function(data) {
doc.setFontSize(14);
doc.text(21, 30, "AMU Handover Sheet");
doc.setFontSize(10);
doc.text(printedOn, doc.internal.pageSize.width / 2, 30, 'center');
var str = "Page " + data.pageCount;
if (typeof doc.putTotalPages === 'function') {
str = str + " of " + totalPagesExp;
}
doc.text(str, doc.internal.pageSize.width - 20, 30, 'right');
};
if (typeof doc.putTotalPages === 'function') {
doc.putTotalPages(totalPagesExp);
}
var elem = document.getElementById("table");
var res = doc.autoTableHtmlToJson(elem);
doc.autoTable(columns, res.data, {
addPageContent: pageContent,
theme: 'grid',
tableLineWidth: 0,
bodyStyles: {
halign: 'center',
valign: 'middle',
fillColor: 250,
lineWidth: 0.5,
lineColor: 180,
cellPadding: 6,
fontSize: 11
},
margin: {
horizontal: 20,
bottom: 40,
top: 40
},
drawRow: function(row, data) {
doc.setFontSize(12);
doc.setFontStyle('bold');
if (row.index === 0) {
doc.setTextColor(30);
doc.rect(data.settings.margin.left, row.y, data.table.width, 30, 'S');
doc.autoTableText("A BAY", data.settings.margin.left + 5, row.y + 16, {
halign: 'left',
valign: 'middle'
});
data.cursor.y += 30;
} else if (row.index === 6) {
doc.setTextColor(30);
doc.rect(data.settings.margin.left, row.y, data.table.width, 30, 'S');
doc.autoTableText("B BAY", data.settings.margin.left + 5, row.y + 16, {
halign: 'left',
valign: 'middle'
});
data.cursor.y += 30;
} else if (row.index === 17) {
doc.setTextColor(30);
doc.rect(data.settings.margin.left, row.y, data.table.width, 30, 'S');
doc.autoTableText("C BAY", data.settings.margin.left + 5, row.y + 16, {
halign: 'left',
valign: 'middle'
});
data.cursor.y += 30;
} else if (row.index === 28) {
doc.setTextColor(30);
doc.rect(data.settings.margin.left, row.y, data.table.width, 30, 'S');
doc.autoTableText("SIDE ROOMS", data.settings.margin.left + 5, row.y + 16, {
halign: 'left',
valign: 'middle'
});
data.cursor.y += 30;
} else if (row.index === 30) {
doc.setTextColor(30);
doc.rect(data.settings.margin.left, row.y, data.table.width, 30, 'S');
doc.autoTableText("FAIRFAX", data.settings.margin.left + 5, row.y + 16, {
halign: 'left',
valign: 'middle'
});
data.cursor.y += 30;
}
},
headerStyles: {
fillColor: 120,
halign: 'center',
valign: 'middle',
fontSize: 12,
},
alternateRowStyles: {
fillColor: 255
},
columnStyles: {
0: {
columnWidth: 40
},
1: {
columnWidth: 180,
halign: 'left',
},
2: {
columnWidth: 240
},
}
});
doc.save("table.pdf");
})
Can anybody suggest where I am going wrong with this?
I think putTotalPages() has to be called after autotable.
there's no data in load Event ( chart.series[0].data )
error code : Uncaught TypeError: Cannot read property 'open' of undefined
then put enabled:false like this..
ex)
dataGrouping: {
enabled: false
units: groupingUnits
},
it works, but too slow..
what should i do?
Here's my code:
$(document).ready(function(){
var area = {
chart:{
height:500,
marginRight:30,
backgroundColor:'#F4F4F4',
events: {
load: function() {
var chart = $('#container').highcharts();
var point = chart.series[0].data[chart.series[0].data.length -1];
text = chart.renderer.text(
'',
point.plotX + chart.plotLeft + 10,
point.plotY + chart.plotTop - 10
).attr({
zIndex: 5
}).add(),
box = text.getBBox();
chart.renderer.rect(box.x - 5, box.y - 5, box.width + 10, box.height + 10, 5)
.attr({
fill: '#FFFFEF',
stroke: 'gray',
'stroke-width': 1,
zIndex: 4
})
//.add();
series1 = this.series[0];
series2 = this.series[1];
//dataMax
var price = series1.data[series1.data.length -1].open;
refreshIntervalId = setInterval(function () {
var x = series1.data[series1.data.length -1].x; // current time
var time = (new Date).getTime();
var o = series1.data[series1.data.length -1].open;
var h = series1.data[series1.data.length -1].high;
var l = series1.data[series1.data.length -1].low;
if(time % 2 === 0){
price = o + Math.random() * 3;
}
else {
price = o - Math.random() * 3;
}
if(price > series1.data[series1.data.length -1].high){
h = price;
}
if(price < series1.data[series1.data.length -1].low){
l = price;
}
var c = price;
var y = series2.data[series2.data.length -1].y + Math.round(Math.random() * 1);
series1.data[series1.data.length -1].update({x : x, open : o, high: h, low: l, close: c}, true);
series2.data[series2.data.length -1].update({x : x, y: y}, false);
}, 1000);
}
}
},
credits: {
enabled:true,
position: { align: 'right', x: -10, verticalAlign: 'bottom', y: -5 },
style: { cursor: 'pointer', color: 'black', fontSize: '9px' }
},
scrollbar: {
enabled: false
},
rangeSelector: {
selected: 1,
inputEnabled: false
},
title: {
useHTML: true,
x: -10,
y: 8,
},
xAxis: {
gridLineWidth: 1,
labels: {
format: '{value:%m-%d}',//'{value:%Y-%m-%d}',
}
},
yAxis:[{
crosshair: {
snap: false
},
height: 200,
labels: {
align: 'right',
x: 25,
formatter: function (){
return $.number(Highcharts.numberFormat(this.value, 0,'',''));
}
},
},
/*volume*/
{
labels: {
align: 'right',
x: 20,
},
// lineWidth: 2
top: 280,
height: 113,
offset: 0,
}],
series: [{
type: 'candlestick',
name: 'AAPL Stock Price',
data: data,
dataGrouping: {
units: groupingUnits
},
point:{
events:{
mouseOver: function (){
var chart = this.series.chart;
if (!chart.lbl){
chart.lbl = chart.renderer.label('')
.attr({
padding: 10,
r: 10,
//fill: Highcharts.getOptions().colors[1]
})
.css({color: 'black'})
.add();
}//if OFF
var timeStamp = this.x,
date = new Date(parseFloat(timeStamp)),
currentTime = get_Date(date);
chart.lbl
.show()
.attr({
text: currentTime + ' H: ' + $.number(this.high) + ' L: ' + $.number(this.low) + ' O: ' + $.number(this.open) + ' C: ' + $.number(this.close),
y: 22,
});
},//mouseover OFF
mouseOut: function (){
if (this.series.chart.lbl){
this.series.chart.lbl.hide();
}//if OFF
}//mouseout OFF
},//events OFF
},//point OFF
}, //series[0] OFF
{
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1,
dataGrouping: {
units: groupingUnits
},
}]//series[1] OFF
}
var dataLength = data.length,
i = 0;
groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]];
for (i; i < dataLength; i += 1) {
candlestickOhlc.push([
data[i][0], // the date
data[i][1], // open
data[i][2], // high
data[i][3], // low
data[i][4] // close
]);
volume.push([
data[i][0], // the date
data[i][5] // the volume
]);
}//for OFF
option = candlestick;
option.series[0].data = data;
$('#container').highcharts('StockChart', option);
});