SnehaSuman free asked 5 years ago


var scatterDataFinal = []; var ctxSc = document.getElementById('ScatterChart').getContext('2d'); var scatterData = { datasets: [{ borderColor: 'rgba(99,0,125, .2)', backgroundColor: 'rgba(99,0,125, .5)', label: '(Run Date,Run Count)', data: dataArray }] } var i=1; var config1 = new Chart.Scatter(ctxSc, { data: scatterData, options: { title: { display: true, text: 'Scatter Chart - Linear X-Axis' }, scales: { xAxes: [{ type: 'linear', position: 'bottom', ticks: { userCallback: function (tick) {

            if(i==1){
                for(j=0;j<scatterData.datasets[0].data.length;j++){

                    scatterDataFinal.push(new Axis(moment(scatterData.datasets[0].data[j].x).format('MMM D, YY'),  scatterData.datasets[0].data[j].y));
                }

                i=2;
            }
              return  moment(tick).format('MMM D, YY'); 
      },
    },
    scaleLabel: {
      labelString: 'Run Date',
      display: true,
    }
  }],
  yAxes: [{
    type: 'linear',
    ticks: {
      userCallback: function (tick) {
        return tick.toString() ;
      }
    },
    scaleLabel: {
      labelString: 'Run Count',
      display: true
    }
  }]
}

} });

}

function formatDate(date){ return new Date(date.substr(6,9), parseInt(date.substr(0,2))-1, date.substr(3,2)); } function Axis(x, y) { this.x = x; this.y = y;

}

is it possible to show the text of x axis label vertically ie they will be on x axis but texts are rotated by 90 degree


Marta Wierzbicka staff answered 5 years ago


Hi,

please, create a snippet, showing the problem here: https://mdbootstrap.com/snippets/. I'll try to help you.

Best, Marta



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.4
  • Device: laptop
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No