0

can any one tell me how to put the y-axis label in chartjs i have already tried the ChartNew.js and it is increasing the height and width of the canvas. this how graph looks like with normal chart.js enter image description here

when i use chartnew.js same graph look like this but it shows the label enter image description here

cssyphus
  • 37,875
  • 18
  • 96
  • 111
rashfmnb
  • 9,959
  • 4
  • 33
  • 44
  • Please don't edit the answer into your question. If you want to make this as solved, post an answer below. You will have the option to accept that answer, which will mark this question as "solved". – user229044 Apr 09 '15 at 04:49

1 Answers1

0

i have resolved this by using this css

 .axisLabel {
    position: absolute;
    text-align: center;
    font-size: 12px;
}

.xaxisLabel {
    bottom: 3px;
    left: 0;
    right: 0;
}

#placeholder {
    width: 600px;
    height: 300px;
    padding: 10px 5px 0 0;
    margin: 15px auto 30px auto;
    border: 1px solid #ddd;
    background: #fff;
    background: linear-gradient(#f6f6f6 0, #fff 50px);
    background: -o-linear-gradient(#f6f6f6 0, #fff 50px);
    background: -ms-linear-gradient(#f6f6f6 0, #fff 50px);
    background: -moz-linear-gradient(#f6f6f6 0, #fff 50px);
    background: -webkit-linear-gradient(#f6f6f6 0, #fff 50px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    -o-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    -ms-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    -moz-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    -webkit-box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.yaxisLabel {
    top: 50%;
    left: -10px;
    transform: rotate(-90deg);
    -o-transform: rotate(-90deg);
    -ms-transform: rotate(-90deg);
    -moz-transform: rotate(-90deg);
    -webkit-transform: rotate(-90deg);
    transform-origin: 0 0;
    -o-transform-origin: 0 0;
    -ms-transform-origin: 0 0;
    -moz-transform-origin: 0 0;
    -webkit-transform-origin: 0 0;
}

and insert the div above the canvas like this

 <div class='axisLabel yaxisLabel' style="margin-top:35px">Revenue (AED)</div>

rashfmnb
  • 9,959
  • 4
  • 33
  • 44