Lightweight Java Graph

I'm developing a product that involves using an ESP32 microcontroller in conjunction with NODE-Red.

Inside the microcontroller there will be an embedded webserver and I would like to place a graphic, but I need a very light, lean graphic that does not have any external links. Because the webserver won't browse the internet.

Any suggestion ?

I don't know if I can post this here in this forum. As you are all beasts... I decided to ask for help.

Hello @allacmc ,
You can use node red and influxdb to store high volume data at millisecond rate and plot on nodered ui graph easily.
if not this could help you https://randomnerdtutorials.com/esp32-plot-readings-charts-multiple/
There may not be storage of data involve. you have to figure it out.

I already imagined that posting the doubt here would cause confusion.

So in my case I use ESP32 with an internal webserver.

This ESP32 does not have access to the internet or the network, nor to any server with node-red, nor influx-db.

I can work with good graphics, but they depend on the internet.

But I need something that doesn't depend on the internet and it can't be that huge java code either.

I can make it work fine.

More need something without external references (can not depend on the internet).

Let me ask some clarifying questions.

Do you really mean Java or do you mean JavaScript?

This graph is to be displayed when a user browses to the esp embedded webpage (not the node-red dashboard)?

Apart from the product you are building involves node-red, what does part does node-red have to do with this?

There are several javascript charting libraries, chart.js for example. A search will find others.

You can use any chartlibrary that is served via cdn, download and serve it locally.

I use apexcharts for these use cases, their cdn library is here.

Perhaps helpful - serve the file via SPIFFS

1 Like

But was the library is big kb

How much storage does the ESP32 have?

chart.js seems to be only 60k in basic form

1 Like

I'm confused. Do you want the chart embedded as an image in the ESP? If so, why? Why not get Node-RED to do the charting? If you don't want it embedded, I'm not sure why you are worried?

using SPIFFS you should have enough storage.

@TotallyInformation - my understanding is that the idea is for the esp to be completely disconnected from internet but be able to serve up charts of locally acquired data - no Node-RED at all in this picture so far - so needs a charting library and web server running locally (as well as data acquisition and storage)

Ah, I see. So yes, using the ESP's local store would enable the chart JavaScript library to be kept locally and incorporated into the web page.

Another, possibly not quite so nice approach might be the old fashioned way which would be to build the image bitmap manually. Writing yourself some C++ functions to "draw" the axes and points. Would be easiest to avoid drawing lines between the points though I've no doubt someone has created a simple C library to do just that somewhere.

To be honest though, I think that an ESP32 would have more than enough CPU, storage and memory to handle serving up a simple line chart (and being pedantic for a second, this IS a chart, not a graph :wink: ).

I generally prefer uPlot at around 45k but I would agree that Chart.js would be decent and is simple to use. Chartist.js is also about the same size as chart.js I think but it is harder to work with.

1 Like

exactly, the ESP32 is completely disconnected from the internet and even so I need to generate the graph. Although I use the Red node I need this esp32 to work completely disconnected.

You now have the information you need to do this.

I would like to thank you for the suggestions.

That were reported in the topic, although this forum is not ESP32 I already knew that the people here are wild enough to take these questions by letter.

I made the decision to search one of the several libraries suggested and upload the js file internally in ESP32.

In this way, it generates the graph completely disconnected from the WEB.

Thanks again to all.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.