| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- /*=========================================================================================
- File Name: column.js
- Description: Chartjs column chart
- ----------------------------------------------------------------------------------------
- Item Name: Robust - Responsive Admin Theme
- Version: 1.2
- Author: PIXINVENT
- Author URL: http://www.themeforest.net/user/pixinvent
- ==========================================================================================*/
- // Column chart
- // ------------------------------
- $(window).on("load", function(){
- //Get the context of the Chart canvas element we want to select
- var ctx = $("#column-chart");
- // Chart Options
- var chartOptions = {
- // Elements options apply to all of the options unless overridden in a dataset
- // In this case, we are setting the border of each bar to be 2px wide and green
- elements: {
- rectangle: {
- borderWidth: 2,
- borderColor: 'rgb(0, 255, 0)',
- borderSkipped: 'bottom'
- }
- },
- responsive: true,
- maintainAspectRatio: false,
- responsiveAnimationDuration:500,
- legend: {
- position: 'top',
- },
- scales: {
- xAxes: [{
- display: true,
- gridLines: {
- color: "#f3f3f3",
- drawTicks: false,
- },
- scaleLabel: {
- display: true,
- }
- }],
- yAxes: [{
- display: true,
- gridLines: {
- color: "#f3f3f3",
- drawTicks: false,
- },
- scaleLabel: {
- display: true,
- }
- }]
- },
- title: {
- display: true,
- text: 'Chart.js Bar Chart'
- }
- };
- // Chart Data
- var chartData = {
- labels: ["January", "February", "March", "April", "May"],
- datasets: [{
- label: "My First dataset",
- data: [65, 59, 80, 81, 56],
- backgroundColor: "#673AB7",
- hoverBackgroundColor: "rgba(103,58,183,.9)",
- borderColor: "transparent"
- }, {
- label: "My Second dataset",
- data: [28, 48, 40, 19, 86],
- backgroundColor: "#E91E63",
- hoverBackgroundColor: "rgba(233,30,99,.9)",
- borderColor: "transparent"
- }]
- };
- var config = {
- type: 'bar',
- // Chart Options
- options : chartOptions,
- data : chartData
- };
- // Create the chart
- var lineChart = new Chart(ctx, config);
- });
|