MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

Trouble converting to a config.js or CSS parameter



  • I have installed the MMM-WeatherChart module ( Tatsuma Matsuki) but I am struggling to understand how to convert

            datasets.push({
                label: 'Minimum Temparature',
                backgroundColor: this.config.backgroundColor,
                borderColor: this.config.color,
                pointBackgroundColor: this.config.color,
                datalabels: {
                    color: this.config.color,
                    align: 'top'
    

    In to someething resembling this below

    minimumTemperatureAlign : "below",

    Because I don’t see where there is anything resembling this.config.minimumTemperature .
    There is just the one reference to label: `Minimum Temperature`,
    In a nutshell align is referring to the text being above the Minimum Temperature trend line.
    There are several blocks in this same style relating to various of what seem to be CSS elements. I don’t understand how to get from the code block to the CSS property since I think this is being done using chart.js to build the grah.



  • @ankonaskiff17 chartjs doesn’t expose its css. It does expose tons of settings.

    Which i expose on my MyCovid19 module



  • Put in issue in on Github about why the rain amount was not converting to inches when units are specified as imperial. Author of module resolved that yesterday. Also asked about scale on vertical axis as it seems too tight and rain trend wants to bang in to temperature trends.
    Just sent him picture showing that.
    Several things were able to be changed directly in the script but after following your advice to do all that in ether custom.css or config.js there was no way to access those parameters.

    Spent a few hours looking at chart.js to see ifI could translate that to items in module but couldn’t find anything.



  • @ankonaskiff17 when u ask chartsjs to draw. U pass in an options structure. It has all the styles

    See my module
    https://github.com/sdetweil/MyCovid19
    the updateOptions function



  • I read through you code and reasonably easy to follow along and you gave everything unique names which helps.
    The WeatherChart OTOH that uses the same block of code but doesn’t really lay out the underlying chart.js stuff which in that case I have failed to make work.
    Obviously if I can change it in the script itself I should be able to make it work in config.js but that has not been the case after trying oodles of different combinations.


Log in to reply