[C++ or Other Android Development Languages] matheszabi:
I would like to develop and app, which has the main functionality to show a 2D chart. There are others and settings, but this is the main.

Existing similar applications aren't using technologies as how it should and they are releasing apps with to few features or they are draining battery like crazy. This I would like to improve it.

This is for web / desktop

View attachment 2397770

Here are a few sentences from my experience, please correct me if I am wrong!

Many-many of implementations are using SDK and 2D graphics. They draw the whole screen every time. Just sere how your battery drained in 1-2 hours! - some really bad implementation they can drain in 3 minutes, I will show later. One exception is: Metatrader 4: it use NDK and OpenGL, Hey pay me, because I am advertising you! :)

I think the SDK code (.class files) it need to e compiled at runtime execution by virtual machine, which takes CPU usage.

NDK is compiled only one => will use less CPU => will drain less batter as the SDK version.

If this is correct, than it should move more code to NDK if is possible. Not sure about JNI calls overhead!

NDK huuuuge advantage: it will allow to use the phone max available memory ( 1.5GB was last time) instead of SDK max allowed value: 256MB ( in my case, but some devices allow only 24Mb for SDK apps)

If you don't touch this chart than nothing changes, if you set the "Live" option, than the last "candle" will change. The candles are those Red & Green rectangles with the line in upper side and down side with meaning of the open, high, low, close prices. - it is related to business logic, but this special bars can have those 2 lines, which are important. The border of the 1pixel black around the red-green rectangles are for visual effects only. To save battery can be omitted.

(The background text and logos are just for advertisements, nobody cares, not really needed for the user for his actions)

As you can see there is a toolbar, and there are maybe other components too, but when the user want to see highest amount of data than will rotate to landscape and there should be given a Full Screen (in portrait not by default)

I have started the development with a component for rendering with OpenGL ES 2.0.

The UI is in SDK , the renderer there is called, but the method implementation calls the native methods via JNI. The business logic, rendering implementation are all in NDK, which is a native shared library.

Not sure why I started with OpenGL, to have some cool effects, who want to drain his battery faster? or I tough if is faster than will consume less battery? - maybe faster drains, but more: 100 mA from GPU for 0.01 seconds rendering is the same as 10 mA for 0.1 rendering at CPU.

Here I am not sure if I am saving energy. Tell me your opinion!

So I have started learning OpenGL ES 2.0 and all what I saw in tutorials it was triangle triangle triangle, but in this chart there is no triangle, but rectangle, or rectangle+lines or just lines with set width or many triangles?

Here is a cool candle, I would like to see this, but I know the gradients will burn battery.

View attachment 2397797

Here is a bit magnified and you can see how I am thinking:

View attachment 2397798

but can't decide. Because I haven't enough experience, don't know the benchmark results. I would like to see a tear down and expected results:

GL_Lines + glLineWidth

GL_triangles

GL_triangle_strip

As the first option with GL_lines:

A candle would be 1x small line from the Low and High price drawn first. Lets say with 5 pixel width to have room for gradient too, if needed. In worse case only 1 pixel, as how they are using others now.

The candle body: the red/green rectangle with has the info of Open/Close price can be another GL_Lines with 50 pixel width - for example.

Will be gradient or not that would depends on user settings. Not sure how is possible to draw black 1-2 pixel of border for candle body in this case - if the user has that settings.

Seconds option with triangles:

2x triangle can make a square.

There is a square as the small line and there is another one the larger square : the candle body.

The triangle strip case:

if only one GL_triangle_strip:

bottomline: 4 vertices

body other 4

upper line 4 vertices

or small line 4x vertices

+

other 4x vertices , so 2x GL_triangle_strip

I made this:

View attachment 2397837

The first thing it was:

setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY)

It is a rectangle with 2x triangle and a line with width.

The line has less vertices of course, but in this chart is expected to have 50- 200 bars maximum. Minimum 10-20.

What is needed is that cross at mouse location: that dashed line and the numbers ( price ) on the right and some other texts in bottom. X, Y coordinates in text.

View attachment 2397844

Please post your experience, benchmarks, opinion.