如何在Liferay7中使用Echarts3(百度的图表工具)?

时间:2016-08-24 09:23:09

标签: javascript jsp liferay baidu echarts

我需要Liferay7中的图表工具,然后我的老板建议使用百度的免费图表库Echarts3,然而,Liferay使用Jsp而echarts使用js,那么如何将js导入jsp以及如何设置相关Liferay 7中的房地产? 这是echarts3演示:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- including ECharts file -->
<script src="echarts.js"></script>
</head>
<body>
<!-- prepare a DOM container with width and height -->
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    // based on prepared DOM, initialize echarts instance
    var myChart = echarts.init(document.getElementById('main'));

    // specify chart configuration item and data
    var option = {
        title: {
            text: 'ECharts entry example'
        },
        tooltip: {},
        legend: {
            data:['Sales']
        },
        xAxis: {
            data: ["shirt","cardign","chiffon shirt","pants","heels","socks"]
        },
        yAxis: {},
        series: [{
            name: 'Sales',
            type: 'bar',
            data: [5, 20, 36, 10, 10, 20]
        }]
    };

    // use configuration item and data specified to show chart
    myChart.setOption(option);
</script>

Get Started with ECharts in 5 minutes

0 个答案:

没有答案