<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>ECharts</title>
<script src="../../res/js/echarts.js"></script>
<script src="../../res/js/jquery.js"></script>
</head>
<body>
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('main')); // 指定图表的配置项和数据
var option = { color: ['#ca8622', '#bda29a'],
//['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83', '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3']
title: {
text: '维度分析'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data: ['销量','小组绩效']
},
xAxis: {
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
},
yAxis: {},
series: [{
name: '销量',
type: 'bar',
data: [5, 20, 36, 10, 10, 20]
},
{
name: '小组绩效',
type: 'bar',
data: [85,90,88,86,95,90]
}
]
}; // 使用刚指定的配置项和数据显示图表。
myChart.setOption(option); //$.getJSON('Handler1.ashx', {
// request:"ssss"
//}, function (json) {
// alert("22"); //}
//); /* 测试可以
$.ajax({
url: 'Handler1.ashx',
type: 'GET',
dataType: 'json',
timeout: 1000,
async: false,
success: function (xml,dstat) {
// alert(xml);
//此处xml就是XML的jQuery对象了,你可以用find()、next()或XPath等方法在里面寻找节点, 和用jQuery操作HTML对象没有区别
option = xml;
myChart.setOption(option);
},
error: function (er) {
alert(er.responseText);
}
});
*/ </script>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web; namespace AppBox.CRM.Gift
{
/// <summary>
/// Handler1 的摘要说明
/// </summary>
public class Handler1 : IHttpHandler
{ public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
//context.Response.Write("Hello World");
StringBuilder strjson = new StringBuilder();
strjson.AppendLine("{");
strjson.AppendLine("\"title\": {");
strjson.AppendLine(" \"text\": 'ECharts 入门示例'");
strjson.AppendLine("},");
strjson.AppendLine("\"tooltip\": {},");
strjson.AppendLine("\"legend\": {");
strjson.AppendLine(" \"data\": ['销量']");
strjson.AppendLine("},");
strjson.AppendLine("\"xAxis\": {");
strjson.AppendLine(" \"data\": [\"衬衫\", \"羊毛衫\", \"雪纺衫\", \"裤子\", \"高跟鞋\", \"袜子\"]");
strjson.AppendLine("},");
strjson.AppendLine("\"yAxis\": {},");
strjson.AppendLine("\"series\": [{");
strjson.AppendLine(" \"name\": '销量',");
strjson.AppendLine(" \"type\": 'bar',");
strjson.AppendLine(" \"data\": [20, 20, 20, 10, 10, 100]");
strjson.AppendLine("}]");
strjson.AppendLine("}");
context.Response.Write(strjson.ToString().Replace("'","\""));
} public bool IsReusable
{
get
{
return false;
}
}
}
}

echarts.js文件,刚开始下载错了.

最新文章

  1. XSS(跨站脚本攻击)的最全总结
  2. jQuery triger与trigerHandler的区别
  3. js 组件的写法
  4. java用正则表达式获取domain
  5. Fragment防止自动清理 (ViewPager滑动时,滑出屏幕后被清理)(转)
  6. C++11标准中常用到的各种算法汇总.
  7. 学习ELk之----02. Elastic Search操作入门
  8. ext前后台数据传输的标准化
  9. 鱼骨时间轴案例(转自CSDN,原文链接附于文中)
  10. 【数学建模】day04-插值与拟合
  11. C 输出变量值到文件中的方法
  12. Mac下安装m2crypto 解决找不到openssl头文件的错误
  13. Dropout原理解析
  14. 使用Docfx生成项目文档
  15. mysql导入导出数据过大命令
  16. redis集群与分片(2)-Redis Cluster集群的搭建与实践
  17. Windows改桌面文件路径
  18. C/C++基础问题归集
  19. 解决错误:此用户名包含无效字符,请输入有效的用户名。wordpress不能注册中文用户名的问题
  20. delphi XE7 在Android编译SharedActivity时出错

热门文章

  1. P3970 [TJOI2014]上升子序列
  2. P3802 小魔女帕琪
  3. STL-----c++标准模板
  4. 研磨设计模式学习笔记3--适配器模式Adapter
  5. STlink及烧写工具:
  6. Murano Weekly Meeting 2015.08.04
  7. LeetCode 881.救生艇(C++)
  8. SolrCloud的搭建的连接
  9. Python文本数据分析与处理
  10. POJ 1456——Supermarket——————【贪心+并查集优化】