Skip to content

skyksit/hexo-tag-gcharts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hexo-tag-gcharts

A hexo tag for inserting google charts in your blog

Version: 0.1.0 Compatible with Hexo Version 5

install

$ npm install hexo-tag-gcharts --save

Usage

{% gcharts [packageName] [chartType] [width] [height] %}
\\google charts datas goes here
options
\\google charts options goes here
{% endgcharts %}
Name Type Default Description
packageName string corechart The name of google chart packages
chartType string Bar The type of google chart
width string 85% The width of chart, responsive in window.
height string 300px The height of chart (px)

Example

CandlestickChart

GoogleChart CandlestickChart'page

Google Charts Example

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);

  function drawChart() {
    var data = google.visualization.arrayToDataTable([
      ['Mon', 20, 28, 38, 45],
      ['Tue', 31, 38, 55, 66],
      ['Wed', 50, 55, 77, 80],
      ['Thu', 77, 77, 66, 50],
      ['Fri', 68, 66, 22, 15]
      // Treat first row as data as well.
    ], true);

    var options = {
      legend:'none'
    };

    var chart = new google.visualization.CandlestickChart(document.getElementById('chart_div'));

    chart.draw(data, options);
  }
    </script>
  </head>
  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

packageName : corechart chartType : CandlestickChart data :

[
      ['Mon', 20, 28, 38, 45],
      ['Tue', 31, 38, 55, 66],
      ['Wed', 50, 55, 77, 80],
      ['Thu', 77, 77, 66, 50],
      ['Fri', 68, 66, 22, 15]
      // Treat first row as data as well.
    ], true

options :

{
  legend:'none'
}

marktdown Usage

{% gcharts corechart CandlestickChart '85%' '400px' %}
[
    ['Mon', 20, 28, 38, 45],
    ['Tue', 31, 38, 55, 66],
    ['Wed', 50, 55, 77, 80],
    ['Thu', 77, 77, 66, 50],
    ['Fri', 68, 66, 22, 15]
], true
options
{
  legend:'none'
}
{% endgcharts %}

For more details, visit Demo here.

About

A hexo tag for inserting google charts in your blog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published