Skip to content
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

Some problems about CandleStickChart #348

Closed
YariZhang opened this issue Sep 8, 2015 · 4 comments
Closed

Some problems about CandleStickChart #348

YariZhang opened this issue Sep 8, 2015 · 4 comments

Comments

@YariZhang
Copy link

I want to draw stock k-line chart , so I tried to draw it with CandleStickChart , but I found that if there's few dataSets , eg. 5 candles , CandleStickChart drawn them in the full of content rect , it isn't I wanted , maybe I just need the width of candle is 5 or 10 , and draw them from left to right , I tried to change the width of _bodyRect , It worked , but the shadow points was wrong (as shown in figure below) . how can I do? Thank you!
image

@AlBirdie
Copy link
Contributor

AlBirdie commented Sep 8, 2015

I'm sorry, but I couldn't understand what you mean. The screenshot you've given clearly shows that the candle boxes aren't drawn correctly. Is that an issue with the ios-charts library, or is that due to your own fiddling with the CandleStickChartRenderer's drawing method? If so, what is it really that you are trying to achieve?

@YariZhang
Copy link
Author

@AlBirdie Thanks for replying!Sorry , it’s my expression not clear enough.Yeah , that is ios-charts library . That is my modified appearance, I want to limit the width of the candle, and I don't want to draw them in full of the content rect when only a few datas .(as figure 1 below).Now, I have achieved it , when the data is few, I fill some useless data to xVals and yVals . But by this way, it  will appear blank area when I zoom. (as figure 2 below)So I'd like to limit the width of candle , maybe it is better.

image
(1)
image
(2)

@AlBirdie
Copy link
Contributor

AlBirdie commented Sep 9, 2015

In case you just want to decrease the width of the candles, you can make use of the counter in the CandleStickChartRenderer's drawing method. For instance; if count < 20 -> width = 10. Naturally, the formula here has to be a lot smarter, so that the width is calculated properly for all counts in a way that there are no sudden jumps of candle widths, but a smooth transition instead, just like is is done currently.

However, that will not result in what you've illustrated in figure 1. I'm afraid that will only work with empty values in your dataset.

@YariZhang
Copy link
Author

@AlBirdie Thank you very much! I had achieved that I need . Thanks for helping me to solve this problem. If I have some other problems , I'm afraid that I'll disturb you again . Ha-ha~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants