Jump to content

Recommended Posts

Posted (edited)

Boa noite,

Venho pedir-vos a vossa ajuda com um problema que me deparei.

Isto é para colocar um donut com o EasyPieChart. A ideia é que a legenda fique sobreposta no gráfico.

No Chrome e no Firefox no windows aparece tudo correto. No Chrome no Android não. No chrome no Android, a legenda aparece sempre abaixo do gráfico.

Alguma ideia?

Segue o código:

<div style="position: relative; text-align: center; width: 188px; height: 188px;">
    <div id="chart">
        <canvas></canvas>
    </div>
    <div id="chart-legend">
        <span>0</span>%
    </div>
</div>

O css...

#chart {
  position: absolute;
  width: 188px;
  height: 188px;
  text-align: center;
  font-size: 12px;
}


#chart canvas {
  position: absolute;
  top: 0;
  left: 0;
}

#chart-legend {
  position: absolute;
  top: 80px;
  left: 70px;
  z-index: 1;
}
Edited by taviroquai
Posted

Lá consegui colocar o chart e a legenda como petendia. Usei uma solução que não é suportada por IE8.

#chart {
  position: absolute;
  width: 188px;
  height: 188px;
  left: 50%;
  transform: translate(-50%, 0);
}

#chart canvas {
  position: absolute;
  top: 0;
  left: 0;
}

#chart-legend {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translate(-50%, 0);
  text-align: center;
  font-size: 12px;
  z-index: 1;
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.