A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Jacob Major
#94375 Put in some work to figure out why my code stopped working. Originally I put the yAxes code in the constructor which only worked out if you calibrated the sensor at the very start which would have a wet value of 0%. Then it would shoot up to the max value of the sensor, but still not fixed.
After realizing my error I realized the config method was where I needed that setup code. Additionally I found that you had abstracted the code a bit to a variable called ax, which I edited the ticks field of.

Here is the graph as the plant is watered.
fixed%20Yaxis.png

Code: Select allax.push({
                id: 'C' + idx,
                type: 'linear',
                position: 'right',
                scaleLabel: {
                    display: true,
                    labelString: lst[i].trim(),
                    fontColor: c
                },
                ticks: {
                    fontColor: c,
                    beginAtZero: true,
                    steps: 100,
                    stepValue: 1,
                    max: 100
                }
            });
            var v = lst[i + 1].trim();
            if (v.startsWith('MIN:')) {
                this.#_F.push(1);
                v = v.substring(4);
            } else if (v.startsWith('MAX:')) {
                this.#_F.push(2);
                v = v.substring(4);
            } else this.#_F.push(0);
            this.#_cv.push(v);
        } this.#_ch.data.datasets = ds;
        this.#_ch.options.scales.yAxes = ax;


My next Goal is to have a status div that says whether I need to water it or not.
Inq720 wrote:
Jacob Major wrote:I was able to get this part to work mostly I believe. I will note there are a lot of places I need to replace InqHisto with the name of my new histo class but I think I figured it out. I got it running with minimal errors at least.

Code: Select allyAxes: [{
                            display: true,
                            ticks: {
                                beginAtZero: true,
                                steps: 100,
                                stepValue: 1,
                                max: 100
                            }
                        }]



That's saying something. I am by no means an expert using chart.js... or even a JavaScript. I remember it being a challenge to get everything the way I wanted... especially the moving of the chart to the left, yet keep a zero at the right edge. I toiled with the idea of even mentioning it for end-user's charting/graphing needs. It implies I need to support it.

I'm glad you got it going... let us see the fruit of your labors when you get a chance.

VBR,
Inq
You do not have the required permissions to view the files attached to this post.