Pre loader

Can't update my Heatmap scichart with double value

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

I am developing android app where i received data from pressure sensor(attached to arduino) and want to show it in scichart heatmap. i created succesfully scichart heatmap with IPaletteProvider. Now i want to update the heatmap with pressure sensor but currently i am unable to update my heatmap. Here is my Whole(PressureActivity code)code.

if (intent.getAction().equals(Constants.DATA)) {
String data = intent.getStringExtra(“DATA”);
if (data.contains(“ccccc”)) {
int index = data.indexOf(‘/’);
int indexx = data.indexOf(‘#’);
String d = data.substring((index + 1), indexx);
DoubleValues doubleValues=new DoubleValues(1);
doubleValues.add(Double.parseDouble(d));
dataSeries.updateZValues(doubleValues);
}
}

The above code is piece of android code where i actually received data from arduino and want to show it in heatmap so i update my dataSeries value. In my case
i use UniformHeatmapDataSeries<Integer, Integer, Double> dataSeries
But it did not work and shows only a rectangal of blue color and not updating with coming data.
Any one have any idea how to fix it.Thanks in advance.

Version
V2
  • You must to post comments
0
0

Hi there,

May I ask what size of heatmap do you you use ( size is passed as width and height into data series constructor ). I’m asking because your code creates a DoubleValues with single value then it is used for zValues of heatmap. This means that you code provides value only for single pixel and other values will remain with default values.

To fix it you need to ensure that you call updateZValues() with DoubleValues which have at least WIdth * Height elements ( only first Width * Height elements will be used to update heatmap ):

DoubleValues doubleValues=new DoubleValues();
for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
        doubleValues.add(value);
    }
}
dataSeries.updateZValues(doubleValues);

Or you can update them one by one with updateZAt but it will be slower because Java boxes each value which you pass in:

for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
        dataSeries.updateZAt(x, y, value);
    }
}

Hope that this will help you!

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.