统一开发环境UDE 2013-04-16
效果图:
所用工具:
Amcharts主页:
http://www.amcharts.com/
html代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>amCharts examples</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script src="amcharts/amcharts.js" type="text/javascript"></script>
<script type="text/javascript">
var chart;
var chartData = [{
country: "大米",
litres: 156.90,
other: 123.90,
ceping: 79.00
}, {
country: "小麦",
litres: 131.10,
other: 129.00,
ceping: 79.00
}, {
country: "油条",
litres: 115.80,
other: 59.90,
ceping: 79.00
}, {
country: "锅盔",
litres: 109.90,
other: 157.70,
ceping: 79.00
}, {
country: "面条",
litres: 108.30,
other: 47.74,
ceping: 79.00
}, {
country: "肉",
litres: 99.00,
other: 135.00,
ceping: 79.00
}, {
country: "花",
litres: 135.00,
other: 99.00,
ceping: 79.00
}, {
country: "鸟",
litres: 25.00,
other: 68.86,
ceping: 79.00
}, {
country: "鱼",
litres: 55.00,
other: 67.77,
ceping: 79.00
}];
AmCharts.ready(function () {
// RADAR CHART
chart = new AmCharts.AmRadarChart();
chart.dataProvider = chartData;
chart.categoryField = "country"; //字段名
chart.colors = ['#FAC090', '#92D050', '#7030A0', '#0D8ECF', '#2A0CD0', '#CD0D74'];
chart.fontSize = 14;
// chart.borderAlpha = 1; //整个图标边框 1:有,0:无,0.?:透明度
chart.fontFamily = "微软雅黑,宋体,新宋体";
chart.startDuration = 0; //动画时间
// VALUE AXIS
var valueAxis = new AmCharts.ValueAxis();
valueAxis.axisAlpha = 0.55; //轴透明度
// valueAxis.axisColor = "#CD0D74"; //轴颜色
valueAxis.minimum = 0;
valueAxis.dashLength = 0; //0:实线,1:相隔1像素虚线,2:相差2像素虚线 , ....以此类推
valueAxis.axisTitleOffset = 10; //每列列名偏移量
valueAxis.gridCount = 5; //网状圈数
valueAxis.gridAlpha = 0.55; //圈圈透明度0:透明,1:不透明,默认0.2
valueAxis.radarCategoriesEnabled = true; //是否显示轴的列名,默认true
chart.addValueAxis(valueAxis);
// GRAPH
var graph = new AmCharts.AmGraph();
graph.valueField = "litres";
graph.title = "本地"; //该Graph标题
// graph.bullet = "bubble";
graph.fillAlphas = 0.8; //填充颜色,不透明度
graph.balloonText = "[[value]] litres of beer per year";
var graph1 = new AmCharts.AmGraph();
graph1.valueField = "other";
graph1.title = "上海"; //该Graph标题
graph1.lineThickness = 4; //线条粗细度
graph1.dashLength = 2; //虚线间隔
graph1.bullet = "bubble"; //点类型,气泡
graph1.balloonText = "[[category]]得分是[[value]]";
var graph2 = new AmCharts.AmGraph();
graph2.valueField = "ceping";
graph2.title = "北京"; //该Graph标题
graph2.bullet = "bubble"; //"none", "round", "square", "triangleUp", "triangleDown", "bubble", "custom".
graph2.lineThickness = 4;
graph2.balloonText = "[[category]]得分是[[value]]"; //[[value]], [[description]], [[percents]], [[open]], [[category]]
chart.addGraph(graph);
chart.addGraph(graph1);
chart.addGraph(graph2);
/*********************/
var legend = new AmCharts.AmLegend();
legend.position = "right";
// legend.autoMargins = false;
legend.markerType = "circle";
legend.markerSize = 16;
legend.valueWidth = 10;
// legend.align = "right";
// legend.autoMargins = true;
// legend.borderAlpha = 1;
// chart.addLegend(legend,"legend"); //添加到指定div(id='legend')
chart.addLegend(legend);
// chart.addTitle("图标标题",14,"#0D8ECF",1,"bold"); //图表标题
// chart.removeGraph(graph2); //移除线条
chart.write("chartdiv");
});
</script>
</head>
<body>
<div id="chartdiv" style="width:600px; height:400px;"></div><div id="legend" style="width:120px; height:40px;"></div>
</body>
</html>