-
Notifications
You must be signed in to change notification settings - Fork 93
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
Financial charts #294
Comments
@raven2cz thanks for your interest in chart-fx. Of course, this is possible. There is an existing prototype implementation for the candlestick charts by @petrov9 that builds on top of chart-fx see #64 for details. We could merge this into the master provided @petrov9 agrees to this, as this is his brainchild. Otherwise, the Since chart-fx is a library we won't be able to write your application though and you may need to apply some of your own customizations to adjust the specifics to your taste. 😄 |
The candlesticks and HiLo renderers are most important part of whole visualization. Most important is support for fast rendering and moving of sliding window for visualization of specific time range. Yes, zoom is important too, but the selected "fixed" window which is moved by sliders are more important. So, the correct control for sliders is necessary. We have several UI visualizations in JFreeChart after several years. I post here the examples which are planned for the realization. I know that there is possible to use bridge between jfreechart and javafx, but this is another league. We plan to create new fast platform with perfect fast visualization, no bridges :-) How about CPU and GPU. Do you have some tests if the scene can be process by GPU without software rendering? |
@raven2cz for compatibility reasons, the library uses plain Java (i.e. w/o custom JNI interfaces) and JavaFX as its UI backend. JavaFX supports natively OpenGL- and/or SW-based rendering depending on the hardware you are running it on. Internally, our rendering routines use
There are the following ingredients for developing a fast rendering in JavaFX:
Again, the library is designed to be highly customizable and it's possible to draw financially related chart as demonstrated [here]](https://github.com/petrov9/chart-fx/blob/new_charts/chartfx-chart/src/main/java/de/gsi/chart/renderer/spi/CandleStickRenderer.java) but you may need to adjust some of the plotting choices/renderers to your liking. Hope this brief information is helpful and please feel invited to make a PR contribution in this particular area. |
Thanks for your all details. I checked and tested samples and speed. I already try to implement simple renderer and dataset. It seems as good library! I expect that we will start usage and extend chart-fx with financial package in next years.
|
Regarding (1): I assume the end result would also have to know about Holidays etc. and be more complex to implement than just filtering every 6th & 7th value. Wouldn't it be simpler to just use trading day indices with a custom label mapper? e.g. |
Nice to hear that chart-fx works well for you. Please don't hesitate to share your progress, especially if you at some point want to merge your efforts back into chart-fx (which we definitely encurage).
There is an open feature request for this #77. I agree with @ennerf that there is a lot of hidden complexity in this filtering aproach (e.g. what happens if there is data for an area where there shouldn't be data, due to timezone mixup etc, how should Zoom and other tools handle these gaps ...).
The auto ranging feature only supports auto ranging on the complete DataSet. The axes do not know of each other, so this is not completely straightforward to implement in chartfx.
This is interesting. I actually observed the same behaviour on my development machine but attributed it to my machine setup as others do not seem to have the problem (actually it even works on my machine when I access it remotely via X2Go). Can you share some information about the versions of java, javafx and your operating system? |
Yes. This seems as good trick ( at first glance ). So, which component can be used for extension? I'm chart-fx newbie. I expect AbstractAxisTransform? Like LogarithmicAxisTransform? |
Yes, of course. Financial package/toolbox can be part of the chart-fx "family". There is one potential problem to solve. The API between common chart-fx and financial framework. In the principle, the based API is mainly domain objects which are defined in the separate financial framework. These filled DOs are placed under the datasets and other your interfaces. This is important to keep just one ohlcv instances in the memory. This cannot be stored to directly the datasets defined by chart-fx, because financial framework cannot be depended on the datasets in chart-fx. This has to be discussed which part can be placed to common chart-fx. Maybe defined some datasets as examples for usage of financial toolbox.
separate topic before this post.
Thanks for this idea! The wrapping of Dataset is not good idea, but the javafx binding seems OK. Can you show me some example of this binding when xrange is changed? About Zoomer. It has to be different way, a zoomer has to work, but if the zoomer is used, this feature has to be disabled. I already implement this in jfreechart. So if a slider is used, the feature is activated and works. If the zoomer is used, this feature is disabled temporary. We can add some button too for activate this feature. Technically, there is not necessary to activate or deactivate the feature. If the xaxis slider is used the correct zoom of dataset is necessary to see min-max of yRange.
Testing station is: javafx is not changed, I'm using your chart-fx master branch with kernel is 5.9.3-arch1-1, Arch Linux x86_64 |
@raven2cz I'd suggest to store the trading dates as data labels in the DataSet and to use then CategoryAxis. This should then be also compatible with the Zoomer and other plugins. |
Yes, I tested it, and it works. Dataset sends labels to category axis, no gaps, and labels are shown. BUT, there will be a lot of work how to correctly organize minor and major labels, and mainly changes in the zooming time. In actual test case, it is disaster because there is no more automatic logic for labels. See picture example. |
@raven2cz hat seems to be related to the chosen/default xAxis.setOverlapPolicy(AxisLabelOverlapPolicy.SKIP_ALT); You may try the other values as well. |
Thanks, works. But it is terrible usage after several testing. There are many problems with visualization, mainly minor and major grid lines. Not possibility to use correctly unit scaling, to see years if zoom is out, the x-axis still needs good quality processing like TimeAxis. |
So, we will start with prototypes for basic candlesticks first. Which type of co-op do you prefer? Can I create fork of chart-fx, and we will plan merge to repo after feature stabilization ok? Can I ask for your help about an evaluation and code review after finished steps? |
@raven2cz sure, a PR request would be highly appreciated. We follow the usual GH process outlined here and that would start with forking and then performing PR against our repository. Please feel free to make use of GitHub's 'draft PR' option as early as possible to check that your build/modifications pass our automatic build pipeline, static code-analysis, code-coverage, etc. Once you feel that you are finished, you can change the 'draft PR' and request a review. Looking forward to your PR! 👍 🎉 |
Hi @RalphSteinhagen, I'm developing similar candlestick chart. Could you give me a hint how to calculate width of a candle that would be proportional to visible subset of dataset. |
@gregwis maybe have a look at the HistogramRenderer and corresponding sample for getting inspiration. The idea is to base the width on the physical pixel distance between the neighbouring bin centres... Maybe you and @raven2cz could join forces and/or merge your approaches? In any case, we are looking forward to your PRs. |
Hi, yes @gregwis. From my point of view, it is wasting time to make same thing independently... |
My requirements are very similar. I also have already developed a draft version. |
Great, I really like that theme. |
I prefer simple red and green candles without shadows: I tried to implement custom Tooltip. I couldn't inherit from DataPointTooltip and I had to write new one inherited from AbstractDataFormattingPlugin (but only value formatters properties were reused). These two classes are hard to customize, especially for data set with data points with more than one y value. |
Super, @gregwis! Of course that a candlestick renderer supports more color schemes. Actually I tested 5. And your example is called OLDSCHOOL in actual implementation. For prototype is important to try more schemes to see where are the implementation gaps in the design. For example shadows are present in the SAND scheme only and it is applied to all chart line components, for example trend lines too. If the shadow is correctly implemented, it causes "plastic" visualization which is necessary for meetings or projectors. Other schemes are in dark modes, eyecare problems etc. In any way, good work @gregwis! |
@gregwis and @raven2cz we have been recently pushed and released updates regarding the tool tip plugin. You may want to rebase your repositories against the master branch and see whether you still need to provide a parallel development. Keep up the good work and do not be afraid to make a draft PR. It's very helpful to already see already intermediate results. This will make the review process and merge request much easier! Again, looking forward! |
@raven2cz, charts look great! @RalphSteinhagen, I tried with current version and I had problems with customizing your Tooltip: method formatData in AbstractDataFormattingPlugin cannot be simply overriden because it uses private methods getXValueFormatter(final Axis xAxis) and getYValueFormatter(final Axis yAxis). Method formatData takes Tuple with two Numbers - I need 4 values. Therefore methods invoking formatData also have to be overriden. Extended DataPoint subclass added even more compexity. I am looking for a function that allows me to double-click on the chart and automatically scale the data range of Y values to min/max visible X range. Do I have to write a new plugin? |
@RalphSteinhagen, and @gregwis. In my opinion, this completely missing in actual chart-fx. I wrote before that keeping of min-max Y values are alpha-omega for all financial charts. It is a feature for sliding with the slider, for "double-click", button-zooming etc. We will have a lot of work with renderers now. I cannot waste time to study "best" solution correct keeping of Y ranges. Is it possible to create new issue for "core" developers to ensure correctly this functionality? In my opinion, this is not just financial charts that Y-values have to be visible all time (in the restricted X-axis range, not for all data of course). What I mean is presented in this amibroker youtube video from 1:24 for sliding, zooming etc. please look to this short video for understanding. |
@gregwis feel free to change the
True, we haven't considered the candle-stick use-case, since our applications mostly deal with (x,y, + x/y errors)-type data. If you find an elegant way to support both use-cases, please feel free to update that class.
Valid point, this is not implemented as such, and would require either an extension of the Zoomer and/or new second Zoomer plugin implementation. May I suggest that you open another dedicated issue/feature request, detailing your/this use-case? This issue/track is already getting quite long and mixes-up different features requests and extensions. Thanks in advance. |
Hey everyone, thanks for the updates, this all looks really nice. Keep up the good work, Alex |
Approved required for merging #318. Reviewer needs write access rights. |
Hi @wirew0rm, |
Hello @RalphSteinhagen or others, |
@raven2cz very good. Had a brief look at your PR. At a first glance, there seem to be only very few and minor issues. I especially appreciate that you minimised the PMD notifications and provided some unit tests. That makes a big difference. 👍 Regarding our restyled-io bot: the fix-PR seems to erroneously try to merge the fixes directly into the chart-fx master and not your repository's feature branch. Seems to be a bot setup problem that we need to follow-up later. In the mean-time, could you run either the formatter script on your branch and/or merge the proposed restyled-io bot commits to your feature branch? Thanks in advance. We are presently occupied with unrelated internal matters, but will have a more detailed look over the weekend and we will provide feedback early next week. However, since your PR passes all formal CI checks, we are quite confident that we can merge this then very soon afterwards. 👍 |
Thanks for info. PR Restyle Financial Chart: CandleStickRenderer, HighLowRenderer, Basic Financial API #318 is not relevant and has to be deleted. In actual time, there is no chance to merge restyle results which are corrupted. |
Info courtesy by @wirew0rm: If you have clang format > 9.0.0 (which should be available on archlinux) you can just run |
Yes, close it. For next financial components we will create new issues. Step by step. |
😮 is it Christmas already? Please keep these good PRs coming! 😄 👍 |
Hi all, |
Dear all friends, Can also work as developer/contributor to chart-fx if necessary~ Best and thanks,
|
@yezhengli-Mr9 I'm not sure if I understand your requirements. Perhaps try to describe it in your own words and let chat-gpt translate the precise description into English. So far, I have understood it as you wanting to automate the Y-axis so that the min-max is always visible in the given window. However, this has already been implemented long ago. In the examples mentioned in the toolbox, there is a boolean auto-y. If you check this box, this feature will be activated for the current width of the sliding window. The library should be intended primarily for users with more advanced skills in Java and JavaFX. In most cases, it is necessary to write some custom parts or connect it to your own trading platform. The examples show a simulation of a trading platform and simple data loading, but it is important to realize that these are just examples, and for full functionality, you need to integrate this library with more advanced parts of your frameworks. |
We are planning to implement new financial platform. There are requirements for realtime processing. Almost all reqs are based on time series. The type of charts are candlesticks, HiLo renderers.
About UI control is necessary to move dynamically and fast in windowed time range, to see detailed structure of prices.
The last important req is possibility to add lines to the chart for visualization entries and exits of trades. There can be a thousands these objects which can be added to the chart for visualization.
Is it possible to used your library for it? Or do you recommend to start from javafx directly?
Thanks for your advice.
The text was updated successfully, but these errors were encountered: