Chartjs line chart with only one center point - Javascript Chart.js

Javascript examples for Chart.js:Line Chart

Description

Chartjs line chart with only one center point

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){//from  w w  w. j av  a 2  s.co m
var chartData = {
  labels: ['', "A", 'test test test test test test test'],
  datasets: [
    {
      fillColor: "rgba(255, 52, 21, 0.2)",
      pointColor: "#da4e2C",
      strokeColor: "#da4e2C",
      data: [null, 20, null]
    },
    {
      fillColor: "rgba(52, 21, 255, 0.2)",
      strokeColor: "#1C57A8",
      pointColor: "#1C57A8",
      data: [null, 30, null]
    },
  ]
}
var ctx = document.getElementById("lineChart").getContext("2d");
var myNewChart = new Chart(ctx).Line(chartData);
    }

      </script> 
   </head> 
   <body> 
      <canvas id="lineChart" width="600" height="400"></canvas>  
   </body>
</html>

Related Tutorials