| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /*=========================================================================================
- File Name: line.js
- Description: Chartjs simple line chart
- ----------------------------------------------------------------------------------------
- Item Name: Robust - Responsive Admin Theme
- Version: 1.2
- Author: PIXINVENT
- Author URL: http://www.themeforest.net/user/pixinvent
- ==========================================================================================*/
- // Line chart
- // ------------------------------
- $(window).on("load", function(){
- //Get the context of the Chart canvas element we want to select
- var ctx = $("#line-chart");
- // Chart Options
- var chartOptions = {
- responsive: true,
- maintainAspectRatio: false,
- legend: {
- position: 'bottom',
- },
- hover: {
- mode: 'label'
- },
- scales: {
- xAxes: [{
- display: true,
- gridLines: {
- color: "#f3f3f3",
- drawTicks: false,
- },
- scaleLabel: {
- display: true,
- labelString: 'Month'
- }
- }],
- yAxes: [{
- display: true,
- gridLines: {
- color: "#f3f3f3",
- drawTicks: false,
- },
- scaleLabel: {
- display: true,
- labelString: 'Value'
- }
- }]
- },
- title: {
- display: true,
- text: 'Chart.js Line Chart - Legend'
- }
- };
- // Chart Data
- var chartData = {
- labels: ["January", "February", "March", "April", "May", "June", "July"],
- datasets: [{
- label: "My First dataset",
- data: [65, 59, 80, 81, 56, 55, 40],
- fill: false,
- borderDash: [5, 5],
- borderColor: "#673AB7",
- pointBorderColor: "#673AB7",
- pointBackgroundColor: "#FFF",
- pointBorderWidth: 2,
- pointHoverBorderWidth: 2,
- pointRadius: 4,
- }, {
- label: "My Second dataset",
- data: [28, 48, 40, 19, 86, 27, 90],
- fill: false,
- borderDash: [5, 5],
- borderColor: "#00BCD4",
- pointBorderColor: "#00BCD4",
- pointBackgroundColor: "#FFF",
- pointBorderWidth: 2,
- pointHoverBorderWidth: 2,
- pointRadius: 4,
- }, {
- label: "My Third dataset - No bezier",
- data: [45, 25, 16, 36, 67, 18, 76],
- lineTension: 0,
- fill: false,
- borderColor: "#FF5722",
- pointBorderColor: "#FF5722",
- pointBackgroundColor: "#FFF",
- pointBorderWidth: 2,
- pointHoverBorderWidth: 2,
- pointRadius: 4,
- }]
- };
- var config = {
- type: 'line',
- // Chart Options
- options : chartOptions,
- data : chartData
- };
- // Create the chart
- var lineChart = new Chart(ctx, config);
- });
|