matteodanelli / MMM-cryptocurrency

A MagicMirror module for crypto currencies value.
MIT License
96 stars 42 forks source link

Change graph width #20

Open jinjirosan opened 6 years ago

jinjirosan commented 6 years ago

The graph itself, on my mirror, is about 93px wide however only the right half of that is the actual graph. The left half is just empty space.

Do you know how I can remove that white space?

It currently makes the whole top right region too wide. Thx.

lordvalium commented 6 years ago

sorry i dont know. And what white space do you mean? Could you please make a screenshot?

jinjirosan commented 6 years ago

Thx for getting back to me.

This image shows the actual graph and this image shows the total width. There is quite some space in that cell between the text and the actual graph itself.

(edit: images urls)

matteodanelli commented 6 years ago

Well, I am not able to reproduce the spacing. Could you please post module configuration?

jinjirosan commented 6 years ago

of course. I've been digging through CSS and with Chrome Developer Tools but can't seem to narrow down why the spacing is there.

            {
                    module: "MMM-cryptocurrency",
                    position: "top_right",
                    config: {
                            currency: ['ethereum', 'ripple', 'bitcoin', 'iota'],
                            conversion: 'EUR',
                            displayLongNames: 'false',
                            displayType: 'logoWithChanges',
                            significantDigits: '5',
                            showGraphs: 'true',
                            headers: ['change24h', 'change1h', 'change7d'],
                            fontSize: 'medium'
                    }
            },
matteodanelli commented 6 years ago

Pretty strange. Where are you running the module? Raspberry? Which version?

jinjirosan commented 6 years ago

I'm running it on a Pi3 with an up-to-date Jessie.

yes weird. Not sure but is there a dependency in the cryptocurrency table on other modules located in Top Right position?

I have a weather graph that is wider than the cryptocurrency module.

CriticalPoint commented 6 years ago

@jinjirosan if you comment out your weather app and restart the process/reboot the mirror, does it scale correctly?

SpoturDeal commented 6 years ago

Hello

I have fixed my graph size issues by adding one line to the code

                    console.log(graph.src)
                    graph.style.maxWidth="150px";        // This line is added
                    graphWrapper.appendChild(graph)

Also the logos sometimes have size issues i solved it with changing these lines

                logo.src = '/my-crypto/' + this.folder + apiResult[j].id + '.png'
                //logo.setAttribute('width', '50px')            ** remarked out
                //logo.setAttribute('height', '50px')           ** remarked out
                logo.style.maxWidth="50px";                    // added these two lines
                logo.style.maxHeight="50px";                   //  using style is better then attr
                logoWrapper.appendChild(logo)

Now the layout is always proper

newset

jinjirosan commented 6 years ago

@CriticalPoint, sorry for the late reply. Yes it seems it pulls the space wider.

@SpoturDeal, you fixed it! Thx for looking into this. The module is now exactly how I like to see it. (looking at your screenshot, you're also Dutch :-) )

SpoturDeal commented 6 years ago

@jindirosan Yes I am Dutch I did an extended version of this module https://github.com/spoturdeal/MMM-crypto-portfolio there you can add the values of the coin you actually own

lordvalium commented 6 years ago

@SpoturDeal made an amazing extended Version!!