Displaying financial charts on Android


#1

I need to display financial charts on Android, and it seems I have a couple of options:

  1. Display OHLC / candlestick and volume series in a single chart (see attached sample screenshot), and this is my preferred method
  2. Display OHLC / candlestick in one chart and volume in another chart below it (with pan and zoom synchronized)

For option 1:

  1. How to I scale the volume series so that it occupies, say, bottom 20% of the chart?
  2. How do I set the alpha for volume (column series) so that it won’t obscure the OHLC / candlestick series?
  3. Display tick marks and labels for volume on the right-hand side of the chart (so it won’t overlap with price labels)?

For option 2:

  1. As the volume chart is below the OHLC / candlestick chart, how do I (horizontally) align the Y-axis of the volume chart to the chart above so that both charts are displayed with the same width and in the same position?

For both options, I would like to display tick marks and labels inside the chart area. Doing it otherwise would leave too little space for the chart area itself. I’ve read other posts about this matter (setting tick gap to a negative value) but there’s no satisfying answer.

What I’m using:

  1. Mac OS X 10.10.1
  2. Android Studio 1.2.1.1
  3. ShinobiChart 1.7.2 (trial)

  Financial chart sample


#2

Hello yth,

Thanks for getting in touch.

To scale the volume series, one option would be to apply high range padding to your y axis for the volume series. (setRangePaddingHigh(U rangePaddingHigh) on the axis class). You could then either provide a custom set of tick marks, or use a ShinobiChart OnTickMarkDrawListener implementation to not draw tickmarks which are greater than a given value. This would prevent tick marks and labels being drawn all the way up the y axis.

To set the alpha on a column series you would need to set a color, with an alpha value using setAreaColor(int areaColor).

The tick marks for an axis will automatically be drawn on the same side (of the chart) as the axis to which they belong. As such you would just need to make sure that you set your y axis to be on the reverse side using the setPosition method of the Axis.

To align the y axes of two separate charts, you could make use of ShinobiChart.OnAxisRangeChangeListener implementations.

ShinobiCharts for Android does not directly support drawing tick marks and labels inside the plot area. That said, it can often be done with a little work but it can be a little fiddly. The two usual approaches are to use a negative tick gap, as you have mentioned, or to use the ShinobiChart.OnTickMarkDrawListener to offset the tick marks and labels as they are drawn.

I hope that this information helps you,

kind regards,

Kai.