我需要一个Liferay7中的图表工具,然后我的老板推荐使用百度的免费制图库Echarts3,但是Liferay使用Jsp而echarts使用js,那么如何将js导入jsp以及如何在liferay7中设置相关属性?以下是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>发布于 2016-08-24 18:02:57
这并不是特定于Liferay或甚至JSP(适用于任何表示层)的东西,为了使我们的应用程序更加用户友好和交互,许多预先构建的.In插件被广泛用于available.In,为了能使用它们达到我们的目的,我们需要为他们提供必要的数据以及DOM元素(大多是一个div或类),让他们能够向最终用户显示一个交互式结构。有许多其他的图表框架可用,如Chart Js或Google Charts,只要您完成配置它所需的步骤,就可以有效地集成它们。对于eChart,您需要包含给定的JS,提供DOM元素,最后提供必要的数据。
https://stackoverflow.com/questions/39119324
复制相似问题