-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
candlestick chart with volume chart and range selector using highcharts? #320
Comments
If you can find an example implemented in javascript, I can investigate how you might do the same from R using rCharts. |
Here's an example from highcharts.com Happy new year! $(function() {
$.getJSON('http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-ohlcv.json&callback=?', function(data) {
// split the data set into ohlc and volume
var ohlc = [],
volume = [],
dataLength = data.length;
for (i = 0; i < dataLength; i++) {
ohlc.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
])
}
// set the allowed units for data grouping
var groupingUnits = [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]];
// create the chart
$('#container').highcharts('StockChart', {
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Historical'
},
yAxis: [{
title: {
text: 'OHLC'
},
height: 200,
lineWidth: 2
}, {
title: {
text: 'Volume'
},
top: 300,
height: 100,
offset: 0,
lineWidth: 2
}],
series: [{
type: 'candlestick',
name: 'AAPL',
data: ohlc,
dataGrouping: {
units: groupingUnits
}
}, {
type: 'column',
name: 'Volume',
data: volume,
yAxis: 1,
dataGrouping: {
units: groupingUnits
}
}]
});
});
}); |
I will check how this can be achieved using the rCharts binding. Meanwhile, here is an example of a candlestick chart with range selector using eCharts. echarts is not yet in the main branch of rCharts, so you will have to download the echarts binding and make sure that you refer to its correct path in the |
Ramanth, do you have any plan to support Highstock (http://www.highcharts.com/stock/demo/candlestick) in rCharts? With a quick hack (copying rCharts highchart library into a custom hightock libray, modifying the config.yml and a few files there), I could to get highstock to work within rCharts and I am now trying to reproduce some of the Highstock examples. One problem I have is that Highstock is supposed to include Highcharts in itself (it's a superset of functionnalities), so it seems a bit redundant to support both highcharts and highstock under rCharts. I am doing a few tests but so far it seems I can altogether drop the rCharts Highcharts library in my custom build and avoid any possible conflict down the line. For info:
with:
and with Hightstock being just a direct translation of the rChart code for Highcharts:
|
This is cool. Can you post your |
You can see my quick go at of a highstock library on https://github.com/nemonominem/Highstock-rCharts-hack. |
It looks like one may have to have some separate Highcharts and Highstock R objects as the methods and default behaviors are slightly different. Per http://api.highcharts.com/highstock and http://api.highcharts.com/highcharts:
As an example of slightly different behavior, legend is enabled by default in Highcharts and not enabled in Highstock. I suspect a few subtle minor differences like that. One may also want to change the data() method of the Highstock object to reflect the more specific data series usage. I have not bothered with that yet. Then one can simply add an sPlot wrapper function and maybe some ohlcPlot wrapper function too (or alternatively one could create a dedicated R object inheriting from Highstock for OHLC). This could all be packed in a revised highchart library under rCharts. |
This is looking really good! Let me spend some time this weekend going over your code and trying to figure out if it makes most sense to roll this into the |
I apologise for not getting back on this. I have been really busy with stuff. I will certainly take a closer look at this in the next couple of weeks and figure out the best way to add highstocks bindings. |
Any progress on this? I'll add myself to the list of interested individuals :) |
For all of those who don't feel like diving into the magical world of rCharts. Just download it and manually install the package in R. |
@Vapri Thanks for your efforts in doing this. I was thinking more along the lines of creating a sister package |
yea sure, I am willing to help if you want to. |
email me at [email protected] |
Please note, that this is planned feature of dygraph library in the near future: I did research couple of months ago when looking for interactive time-series charting library, also compared highcharts vs dygraphs and settled for dygraphs for three reasons: friendlier licencing, fully open-sourced and speed (direct rendering on canvas, instead of SVG, which might get bogged down on dense datasets) Plugins introduced recently include arrow annotations with popups (trading orders) and synchronized charts with crosshair (for multiple indicators): Working R wrapper here (thank you @ramnathv & @timelyportfolio for indispensable kickstart advice): If you decide to jump on the |
I would agree with @danielkrizian that |
@Vapri I will send you an email and copy to @nemonominem as well so you guys can get together to discuss the best way to put a rChartsHighStock package in place. |
Very excited for Dygraph, looks very nice. |
I agree @Vapri that it makes sense to develop both packages. Highstocks is very refined, with cost probably being the only barrier. But then again, given that it is in the finance domain, cost may not be an issue for many firms. |
Candlestick chart is now implemented in Demo here: Issue tracker if you are interested in tweaking it: |
I want to ask if @ramnathv has made progress on making a Highstock library. I just stumbled on Highstock today, and it is exactly what I need and have been trying to make Highcharts do. So instead of re-inventing the wheel, I am now looking for an R library for Highstock. |
I don't have the bandwidth to focus on |
I am willing to kick in some $$ in a crowdsourced fundraiser if it will help to get this done. |
I would suggest having a peek at rChartsDygraphs . He has been doing a great job and has also kicked in some $ for help on the js side. |
I think most of the work to integrate https://github.com/Vapri/rChartsHighStockMod At this point, I believe it only requires to be cleaned up, documented and packaged appropriately. If anyone is interested, let me know. |
dygraphs looks good but I would rather stick with rCharts only because I am very familiar with Highcharts at this point, and assume Highstocks to be very similar. I do not have the skills to "clean up and package appropriately", so must rely on others to do this. I can only contribute $$$ to help expedite. |
Hi, I'm really interested by the work done to use Highstock library in rCharts. |
@KrysD, |
O sad news ! |
@danielkrizian |
@KrysD once I port |
@ramnathv, it means I could continue to use |
Hi everyone, @KrysD , If anyone still interested in highstock funcionalities you can check highcharter package. Regards |
Hi @jbkunst , |
Hi @Arbitrageur , can you please help me in making that candlestick highchart dynamic.
Dynamic in the sense that whatever data we're getting from the JSON file, that should come one by one after every second and using splice technique also we should remove the first data. |
Could you give me an example?
I'm not sure that this is the right place for asking.. but thanks anyway.
The text was updated successfully, but these errors were encountered: