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.
- mtg khan asked 7 years ago
- You must login to post comments
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
- Yura Khariton answered 7 years ago
- You must login to post comments
Please login first to submit.