'HighCharts: drawing graph paper for ECG on Android

in my Android app I found the need to draw, in a part of my activity, the result of an ECG bluetooth device acquisition; in other activity i can draw graph to visualize other vital parameters using HighCharts without problems, but for ECG a lot of challanges spawned!

The first, and most difficult at the time, is to draw the graph paper where the ECG lies; for those who doesn't know, it's a special grid composed by squares (ticks), major ones composed by 5 minor ones, representing time on X axis (0.2s major tick, 0.04s minor ticks) and voltage on Y axis (0.5mV major ticks, 0.1mV minor ticks).

My goal is to draw this graph paper keeping the size of these squares fixed, for example, 25dp for the major ticks (thus 5d for the minor ticks),both on vertical and horizontal.

Using various HighCharts properties, as

  • setTickPixelInterval
  • setTickInterval
  • setMinotTickInterval

and more, when the duration of the acquisition changes, the graph stretches to reduce the graph length (also using the scrollableArea) modifying the desidered tick dimension.

There's a way to fix the tick dimension in a way that HighChart won't ever modify it?

Thanks in advance!



Solution 1:[1]

The height and width of the HIChart object are in pixels and what you got from your container is probably the value in dp. You need to convert these values to pixels and use that value for the height/width of the chart.

This will really only change the size of the chart that is in the container, i.e. in our HIChartView. I would rather not move the height/width values of the chart but operate directly on the HIChartView.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sebastian Hajdus