using System; using System.Collections.Generic; using System.Web.Mvc; using QMFrameWork.WebUI.Attribute; using QMFrameWork.WebUI.QMEChart; using QMFrameWork.WebUI.QMEChart.Data; using QMAPP.MESReport.Web.Models; using QMAPP.Common.Web.Controllers; using System.Text; namespace QMAPP.MESReport.Web.Controllers { /// /// 图表样例 /// public class EChartExampleController : QController { #region 图表样例 /// /// 加载用户列表 /// /// 结果 [HandleException] public ActionResult EChartExampleList(bool? callBack) { return View(); } #endregion #region 标准折线图 /// /// 标准折线图 /// /// 处理结果 [HandleException] public ActionResult Line1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准折线图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataLine1(string name) { #region 源数据定义 //生成数据 List dataList = new List(); //最高气温 dataList.Add(new TestEChartModel() { Week = "周一", TypeValue = "最高气温", Value = "11" }); dataList.Add(new TestEChartModel() { Week = "周二", TypeValue = "最高气温", Value = "18" }); dataList.Add(new TestEChartModel() { Week = "周三", TypeValue = "最高气温", Value = "15" }); dataList.Add(new TestEChartModel() { Week = "周四", TypeValue = "最高气温", Value = "13" }); dataList.Add(new TestEChartModel() { Week = "周五", TypeValue = "最高气温", Value = "12" }); dataList.Add(new TestEChartModel() { Week = "周六", TypeValue = "最高气温", Value = "16" }); dataList.Add(new TestEChartModel() { Week = "周日", TypeValue = "最高气温", Value = "10" }); //最低气温 dataList.Add(new TestEChartModel() { Week = "周一", TypeValue = "最低气温", Value = "1" }); dataList.Add(new TestEChartModel() { Week = "周二", TypeValue = "最低气温", Value = "6" }); dataList.Add(new TestEChartModel() { Week = "周三", TypeValue = "最低气温", Value = "2" }); dataList.Add(new TestEChartModel() { Week = "周四", TypeValue = "最低气温", Value = "1" }); dataList.Add(new TestEChartModel() { Week = "周五", TypeValue = "最低气温", Value = "3" }); dataList.Add(new TestEChartModel() { Week = "周六", TypeValue = "最低气温", Value = "4" }); dataList.Add(new TestEChartModel() { Week = "周日", TypeValue = "最低气温", Value = "-2" }); #endregion #region 设置图表(必选) //折线图的类型 QMEChartLine chartLine = new QMEChartLine() { LineType = "line1" }; //设置源数据列表 chartLine.DataList = dataList; //标题设置 chartLine.Title.Text = "未来一周气温变化"; chartLine.Title.Subtext = "纯属虚构"; //XAxis横坐标轴设置 chartLine.HaveXAxis = true; chartLine.XAxisField = "Week"; //YAxis纵坐标轴设置 chartLine.HaveYAxis = true; chartLine.YAxis.Type = "value"; //设置Y轴显示格式。 chartLine.YAxis.AxisLabel.Formatter = "{value} °C"; //设置分类 chartLine.LegendField = "TypeValue"; //转换数据格式,用于生成图表的值字段 chartLine.ValueField = "Value"; chartLine.Series = QMEChartHelper.CovertDataToSeries(chartLine); //是否显示图例 chartLine.HaveLegend = true; #endregion #region 设置图表(可选) //是否生成Tooltip提示窗口 chartLine.HaveTooltip = true; //是否存在工具栏 chartLine.HaveToolBox = true; //自定义辅助线 QMECMarkLine ml = new QMECMarkLine() { Data = new List() { new QMECPoint { Type = "average", Name = "平均值" } } }; //设置辅助点 QMECMarkPoint mp = new QMECMarkPoint() { Data = new List() { new QMECPoint() { Type = "max", Name = "最大值" }, new QMECPoint() { Type = "min", Name = "最小值" } } }; foreach (QMECSerie ser in chartLine.Series) { ser.MarkLine = ml; ser.MarkPoint = mp; } #endregion return Content(QMEChartHelper.QMECHelper(chartLine)); } #endregion #region 堆积折线图 /// /// 堆积折线图 /// /// 处理结果 [HandleException] public ActionResult Line2() { try{ return View(); } catch (Exception ex) { throw ex; } } /// /// 堆积折线图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataLine2() { #region 源数据定义 //生成数据 List dataList = new List(); //邮件营销 dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "101", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "134", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "90", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "230", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "210", TypeValue = "邮件营销", StackValue = "总量" }); //联盟广告 dataList.Add(new TestEChartModel() { Week = "周一", Value = "100", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "110", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "120", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "130", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "140", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "150", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "160", TypeValue = "联盟广告", StackValue = "总量" }); //视频广告 dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "141", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "150", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "164", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "177", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "180", TypeValue = "视频广告", StackValue = "总量" }); //直接访问 dataList.Add(new TestEChartModel() { Week = "周一", Value = "180", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "170", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "160", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "150", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "140", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "130", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "120", TypeValue = "直接访问", StackValue = "总量" }); //搜索引擎 dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "130", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "130", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "100", TypeValue = "搜索引擎", StackValue = "总量" }); #endregion #region 默认设置 //设置图形类型 QMEChartLine chartLine = new QMEChartLine() { LineType = "line2" }; //设置源数据列表 chartLine.DataList = dataList; #region 设置标题 //设置标题,有则显示,不设置不显示 chartLine.Title = new QMECTitle(); chartLine.Title.Text = "营销渠道统计"; chartLine.Title.Subtext = "纯属虚构"; #endregion #region ToolBox工具栏设置 //是否存在工具栏,为空时使用默认设置 chartLine.HaveToolBox = true; #endregion #region 是否生成Tooltip窗口 chartLine.HaveTooltip = true; //不设置对象属性时使用系统默认设置 #endregion #region 是否生成Legend图例 //是否有Legend chartLine.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLine.LegendField = "TypeValue"; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLine.HaveXAxis = true; //设置X轴统计类型字段 chartLine.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLine.HaveYAxis = true; #endregion #region 设置数据源的用于堆积处理的字段 //堆积字段,是否是堆积图形 chartLine.StackField = "StackValue"; #endregion #region 生成图形所需要的数据格式 //转换数据格式,值字段 chartLine.ValueField = "Value"; chartLine.Series = QMEChartHelper.CovertDataToSeries(chartLine); #endregion return Content(QMEChartHelper.QMECHelper(chartLine)); #endregion #region 自定义创建图表 //QMEChartLine chartLine = new QMEChartLine() { LineType = "line2" }; //#region 设置标题 ////设置标题,有则显示,不设置不显示 //chartLine.Title = new QMECTitle(); //chartLine.Title.Text = "营销渠道统计"; //chartLine.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //chartLine.HaveTooltip = true; //chartLine.Tooltip = new QMECTooltip(); //chartLine.Tooltip.Trigger = "axis"; //#endregion //#region Legend图例设置 //chartLine.HaveLegend = true; //chartLine.Legend = new QMECLegend() { Data = new List() }; //chartLine.Legend.Data.Add("邮件营销"); //chartLine.Legend.Data.Add("联盟广告"); //chartLine.Legend.Data.Add("视频广告"); //chartLine.Legend.Data.Add("直接访问"); //chartLine.Legend.Data.Add("搜索引擎"); //#endregion //#region Toolbox工具栏设置 //chartLine.HaveToolBox = true; //chartLine.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLine.Toolbox.Show = true; //chartLine.Toolbox.Feature.Mark.Show = true; //chartLine.Toolbox.Feature.MagicType.Show = true; //chartLine.Toolbox.Feature.MagicType.Type.Add("line"); //chartLine.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLine.Toolbox.Feature.MagicType.Type.Add("stack"); //chartLine.Toolbox.Feature.MagicType.Type.Add("tiled"); //chartLine.Toolbox.Feature.Restore.Show = true; //chartLine.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //chartLine.HaveXAxis = true; //chartLine.XAxis = new QMECXAxis() { Data = new List() }; //chartLine.XAxis.Type = "category"; //chartLine.XAxis.BoundaryGap = "false".ToCharArray(); //chartLine.XAxis.Data.Add("周一"); //chartLine.XAxis.Data.Add("周二"); //chartLine.XAxis.Data.Add("周三"); //chartLine.XAxis.Data.Add("周四"); //chartLine.XAxis.Data.Add("周五"); //chartLine.XAxis.Data.Add("周六"); //chartLine.XAxis.Data.Add("周日"); //#endregion //#region YAxis纵坐标轴设置 //chartLine.HaveYAxis = true; //chartLine.YAxis = new QMECYAxis(); //chartLine.YAxis.Type = "value"; //#endregion //#region 生成图表所需要数据格式 //chartLine.Series = new List(); //chartLine.Series.Add(new QMECSerie() { Name = "邮件营销", Type = "line", Stack = "总量", Data = new string[] { "120", "132", "101", "134", "90", "230", "210" } }); //chartLine.Series.Add(new QMECSerie() { Name = "联盟广告", Type = "line", Stack = "总量", Data = new string[] { "220", "182", "191", "234", "290", "330", "310" } }); //chartLine.Series.Add(new QMECSerie() { Name = "视频广告", Type = "line", Stack = "总量", Data = new string[] { "150", "232", "201", "154", "190", "330", "410" } }); //chartLine.Series.Add(new QMECSerie() { Name = "直接访问", Type = "line", Stack = "总量", Data = new string[] { "320", "332", "301", "334", "390", "330", "320" } }); //chartLine.Series.Add(new QMECSerie() { Name = "搜索引擎", Type = "line", Stack = "总量", Data = new string[] { "820", "932", "901", "934", "1290", "1330", "1320" } }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLine)); #endregion } #endregion #region 标准面积图 /// /// 标准面积图 /// /// 处理结果 [HandleException] public ActionResult Line3() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准面积图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataLine3() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "周一", Value = "10", TypeValue = "意向" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "12", TypeValue = "意向" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "21", TypeValue = "意向" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "54", TypeValue = "意向" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "260", TypeValue = "意向" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "830", TypeValue = "意向" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "710", TypeValue = "意向" }); //"10", "12", "21", "54", "260", "830", "710" dataList.Add(new TestEChartModel() { Week = "周一", Value = "30", TypeValue = "预购" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "182", TypeValue = "预购" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "434", TypeValue = "预购" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "791", TypeValue = "预购" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "390", TypeValue = "预购" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "30", TypeValue = "预购" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "10", TypeValue = "预购" }); //"30", "182", "434", "791", "390", "30", "10" dataList.Add(new TestEChartModel() { Week = "周一", Value = "1320", TypeValue = "成交" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "1132", TypeValue = "成交" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "601", TypeValue = "成交" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "234", TypeValue = "成交" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "120", TypeValue = "成交" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "90", TypeValue = "成交" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "20", TypeValue = "成交" }); //"1320", "1132", "601", "234", "120", "90", "20" #endregion #region 默认设置 QMEChartLine chartLine = new QMEChartLine() { LineType = "line3" }; //设置源数据列表 chartLine.DataList = dataList; #region 标题设置 //设置标题,有则显示,不设置不显示 chartLine.Title = new QMECTitle(); chartLine.Title.Text = "某楼盘销售情况"; chartLine.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 //是否显示Tooltip chartLine.HaveTooltip = true; #endregion #region 工具栏设置 //是否显示工具栏 chartLine.HaveToolBox = true; #endregion #region Legend图例设置 //是否有Legend chartLine.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLine.LegendField = "TypeValue"; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLine.HaveXAxis = true; //设置X轴统计类型字段 chartLine.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLine.HaveYAxis = true; #endregion #region 生成图形所需要数据格式 //转换数据格式,值字段 chartLine.ValueField = "Value"; chartLine.Series = QMEChartHelper.CovertDataToSeries(chartLine); #endregion return Content(QMEChartHelper.QMECHelper(chartLine)); #endregion #region 自定义设置 //QMEChartLine chartLine = new QMEChartLine() { LineType = "line3" }; //#region 标题设置 //chartLine.Title = new QMECTitle(); //chartLine.Title.Text = "某楼盘销售情况"; //chartLine.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //chartLine.HaveTooltip = true; //chartLine.Tooltip = new QMECTooltip(); //chartLine.Tooltip.Trigger = "axis"; //#endregion //#region Legend图例设置 //chartLine.HaveLegend = true; //chartLine.Legend = new QMECLegend() { Data = new List() }; //chartLine.Legend.Data.Add("意向"); //chartLine.Legend.Data.Add("预购"); //chartLine.Legend.Data.Add("成交"); //#endregion //#region Toolbox工具栏设置 //chartLine.HaveToolBox = true; //chartLine.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLine.Toolbox.Show = true; //chartLine.Toolbox.Feature.Mark.Show = true; //chartLine.Toolbox.Feature.MagicType.Show = true; //chartLine.Toolbox.Feature.MagicType.Type.Add("line"); //chartLine.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLine.Toolbox.Feature.MagicType.Type.Add("stack"); //chartLine.Toolbox.Feature.MagicType.Type.Add("tiled"); //chartLine.Toolbox.Feature.Restore.Show = true; //chartLine.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //chartLine.HaveXAxis = true; //chartLine.XAxis = new QMECXAxis() { Data = new List() }; //chartLine.XAxis.Type = "category"; //chartLine.XAxis.BoundaryGap = "false".ToCharArray(); //chartLine.XAxis.Data.Add("周一"); //chartLine.XAxis.Data.Add("周二"); //chartLine.XAxis.Data.Add("周三"); //chartLine.XAxis.Data.Add("周四"); //chartLine.XAxis.Data.Add("周五"); //chartLine.XAxis.Data.Add("周六"); //chartLine.XAxis.Data.Add("周日"); //#endregion //#region YAxis纵坐标轴设置 //chartLine.HaveYAxis = true; //chartLine.YAxis = new QMECYAxis(); //chartLine.YAxis.Type = "value"; //#endregion //#region 生成图表所需要数据格式 //chartLine.Series = new List(); //chartLine.Series.Add(new QMECSerie() { Name = "意向", Type = "line", Smooth = true, ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "10", "12", "21", "54", "260", "830", "710" } }); //chartLine.Series.Add(new QMECSerie() { Name = "预购", Type = "line", Smooth = true, ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "30", "182", "434", "791", "390", "30", "10" } }); //chartLine.Series.Add(new QMECSerie() { Name = "成交", Type = "line", Smooth = true, ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "1320", "1132", "601", "234", "120", "90", "20" } }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLine)); #endregion } #endregion #region 堆积面积图 /// /// 堆积面积图 /// /// 处理结果 [HandleException] public ActionResult Line4() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 堆积面积图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataLine4() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "101", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "134", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "90", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "230", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "210", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周一", Value = "100", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "110", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "120", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "130", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "140", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "150", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "160", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "141", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "150", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "164", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "177", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "180", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周一", Value = "180", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "170", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "160", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "150", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "140", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "130", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "120", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "130", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "130", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "120", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "100", TypeValue = "搜索引擎", StackValue = "总量" }); #endregion #region 默认设置 QMEChartLine chartLine = new QMEChartLine() { LineType = "line4" }; //设置源数据列表 chartLine.DataList = dataList; #region 设置标题 //设置标题,有则显示,不设置不显示 chartLine.Title = new QMECTitle(); chartLine.Title.Text = "营销渠道统计"; chartLine.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 //是否显示ToolTip工具条 chartLine.HaveTooltip = true; #endregion #region Toolbox工具栏设置 chartLine.HaveToolBox = true; #endregion #region Legend图例设置 //是否有Legend chartLine.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLine.LegendField = "TypeValue"; #endregion #region XAxis横坐标轴设置 //是否生成XAxis横坐标轴 chartLine.HaveXAxis = true; //设置X轴统计类型字段 chartLine.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLine.HaveYAxis = true; #endregion #region 设置堆积字段 //堆积字段,是否是堆积图形 chartLine.StackField = "StackValue"; #endregion #region 生成图形所需要格式数据 //转换数据格式,值字段 chartLine.ValueField = "Value"; chartLine.Series = QMEChartHelper.CovertDataToSeries(chartLine); #endregion return Content(QMEChartHelper.QMECHelper(chartLine)); #endregion #region 自定义创建图表 //QMEChartLine chartLine = new QMEChartLine() { LineType = "line4" }; //#region 设置标题 ////设置标题,有则显示,不设置不显示 //chartLine.Title = new QMECTitle(); //chartLine.Title.Text = "营销渠道统计"; //chartLine.Title.Subtext = "纯属虚构"; //endregion //#region Tooltip提示窗口设置 //chartLine.HaveTooltip = true; //chartLine.Tooltip = new QMECTooltip(); //chartLine.Tooltip.Trigger = "axis"; //endregion //#region Legend图例设置 //chartLine.HaveLegend = true; //chartLine.Legend = new QMECLegend() { Data = new List() }; //chartLine.Legend.Data.Add("邮件营销"); //chartLine.Legend.Data.Add("联盟广告"); //chartLine.Legend.Data.Add("视频广告"); //chartLine.Legend.Data.Add("直接访问"); //chartLine.Legend.Data.Add("搜索引擎"); //endregion //#region Toolbox工具栏设置 //chartLine.HaveToolBox = true; //chartLine.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLine.Toolbox.Show = true; //chartLine.Toolbox.Feature.Mark.Show = true; //chartLine.Toolbox.Feature.MagicType.Show = true; //chartLine.Toolbox.Feature.MagicType.Type.Add("line"); //chartLine.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLine.Toolbox.Feature.MagicType.Type.Add("stack"); //chartLine.Toolbox.Feature.MagicType.Type.Add("tiled"); //chartLine.Toolbox.Feature.Restore.Show = true; //chartLine.Toolbox.Feature.SaveAsImage.Show = true; //endregion //#region XAxis横坐标轴设置 //chartLine.HaveXAxis = true; //chartLine.XAxis = new QMECXAxis() { Data = new List() }; //chartLine.XAxis.Type = "category"; //chartLine.XAxis.BoundaryGap = "false".ToCharArray(); //chartLine.XAxis.Data.Add("周一"); //chartLine.XAxis.Data.Add("周二"); //chartLine.XAxis.Data.Add("周三"); //chartLine.XAxis.Data.Add("周四"); //chartLine.XAxis.Data.Add("周五"); //chartLine.XAxis.Data.Add("周六"); //chartLine.XAxis.Data.Add("周日"); //endregion //#region YAxis纵坐标轴设置 //chartLine.HaveYAxis = true; //chartLine.YAxis = new QMECYAxis(); //chartLine.YAxis.Type = "value"; //endregion //#region 生成图表所需要数据格式 //chartLine.Series = new List(); //chartLine.Series.Add(new QMECSerie() { Name = "邮件营销", Type = "line", Stack = "总量", ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "120", " 132", " 101", " 134", " 90", " 230", " 210" } }); //chartLine.Series.Add(new QMECSerie() { Name = "联盟广告", Type = "line", Stack = "总量", ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "220", "182", " 191", " 234", " 290", " 330", " 310" } }); //chartLine.Series.Add(new QMECSerie() { Name = "视频广告", Type = "line", Stack = "总量", ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "150", " 232", " 201", " 154", " 190", " 330", " 410" } }); //chartLine.Series.Add(new QMECSerie() { Name = "直接访问", Type = "line", Stack = "总量", ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "320", " 332", " 301", " 334", " 390", " 330", " 320" } }); //chartLine.Series.Add(new QMECSerie() { Name = "搜索引擎", Type = "line", Stack = "总量", ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { AreaStyle = new QMECAreaStyle() { Type = "default" } } }, Data = new string[] { "820", " 932", " 901", " 934", " 1290", " 1330", " 1320" } }); //endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLine)); #endregion } #endregion #region 标准柱状图 /// /// 标准柱状图 /// /// 处理结果 [HandleException] public ActionResult Bar1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准柱状图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataBar1() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "一月", Value = "2.0", TypeValue = "蒸发量", Cate = "zf", SubCate = "m1" }); dataList.Add(new TestEChartModel() { Week = "二月", Value = "4.9", TypeValue = "蒸发量", Cate = "zf", SubCate = "m2" }); dataList.Add(new TestEChartModel() { Week = "三月", Value = "7.0", TypeValue = "蒸发量", Cate = "zf", SubCate = "m3" }); dataList.Add(new TestEChartModel() { Week = "四月", Value = "23.2", TypeValue = "蒸发量", Cate = "zf", SubCate = "m4" }); dataList.Add(new TestEChartModel() { Week = "五月", Value = "25.6", TypeValue = "蒸发量", Cate = "zf", SubCate = "m5" }); dataList.Add(new TestEChartModel() { Week = "六月", Value = "76.7", TypeValue = "蒸发量", Cate = "zf", SubCate = "m6" }); dataList.Add(new TestEChartModel() { Week = "七月", Value = "135.6", TypeValue = "蒸发量", Cate = "zf", SubCate = "m7" }); dataList.Add(new TestEChartModel() { Week = "八月", Value = "162.2", TypeValue = "蒸发量", Cate = "zf", SubCate = "m8" }); dataList.Add(new TestEChartModel() { Week = "九月", Value = "32.6", TypeValue = "蒸发量", Cate = "zf", SubCate = "m9" }); dataList.Add(new TestEChartModel() { Week = "十月", Value = "20.0", TypeValue = "蒸发量", Cate = "zf", SubCate = "m10" }); dataList.Add(new TestEChartModel() { Week = "十一月", Value = "6.4", TypeValue = "蒸发量", Cate = "zf", SubCate = "m11" }); dataList.Add(new TestEChartModel() { Week = "十二月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); dataList.Add(new TestEChartModel() { Week = "十三月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); dataList.Add(new TestEChartModel() { Week = "十四月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); dataList.Add(new TestEChartModel() { Week = "十五月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); dataList.Add(new TestEChartModel() { Week = "十六月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); dataList.Add(new TestEChartModel() { Week = "十七月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); dataList.Add(new TestEChartModel() { Week = "十八月", Value = "3.3", TypeValue = "蒸发量", Cate = "zf", SubCate = "m12" }); //"2.0", "4.9", "7.0", "23.2", "25.6", "76.7", "135.6", "162.2", "32.6", "20.0", "6.4", "3.3" dataList.Add(new TestEChartModel() { Week = "一月", Value = "2.6", TypeValue = "降水量", Cate = "js", SubCate = "m1" }); dataList.Add(new TestEChartModel() { Week = "二月", Value = "5.9", TypeValue = "降水量", Cate = "js", SubCate = "m2" }); dataList.Add(new TestEChartModel() { Week = "三月", Value = "9.0", TypeValue = "降水量", Cate = "js", SubCate = "m3" }); dataList.Add(new TestEChartModel() { Week = "四月", Value = "26.4", TypeValue = "降水量", Cate = "js", SubCate = "m4" }); dataList.Add(new TestEChartModel() { Week = "五月", Value = "28.7", TypeValue = "降水量", Cate = "js", SubCate = "m5" }); dataList.Add(new TestEChartModel() { Week = "六月", Value = "70.7", TypeValue = "降水量", Cate = "js", SubCate = "m6" }); dataList.Add(new TestEChartModel() { Week = "七月", Value = "175.6", TypeValue = "降水量", Cate = "js", SubCate = "m7" }); dataList.Add(new TestEChartModel() { Week = "八月", Value = "182.2", TypeValue = "降水量", Cate = "js", SubCate = "m8" }); dataList.Add(new TestEChartModel() { Week = "九月", Value = "48.7", TypeValue = "降水量", Cate = "js", SubCate = "m9" }); dataList.Add(new TestEChartModel() { Week = "十月", Value = "18.8", TypeValue = "降水量", Cate = "js", SubCate = "m10" }); dataList.Add(new TestEChartModel() { Week = "十一月", Value = "6.0", TypeValue = "降水量", Cate = "js", SubCate = "m11" }); dataList.Add(new TestEChartModel() { Week = "十二月", Value = "2.3", TypeValue = "降水量", Cate = "js", SubCate = "m12" }); //"2.6", "5.9", "9.0", "26.4", "28.7", "70.7", "175.6", "182.2", "48.7", "18.8", "6.0", "2.3" #endregion QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar1" }; //设置源数据列表 chartLBar.DataList = dataList; #region 设置标题 //不为空时显示Title,为空时不显示 chartLBar.Title = new QMECTitle(); chartLBar.Title.Text = "蒸发量-降水量统计图"; chartLBar.Title.Subtext = "纯属虚构"; #endregion #region Legend图例设置 //是否有Legend chartLBar.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLBar.LegendField = "TypeValue"; chartLBar.Grid = new QMECGrid(); chartLBar.Grid.Width = 400; chartLBar.Grid.X = 220; chartLBar.Grid.Y = 100; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLBar.HaveXAxis = true; //设置X轴统计类型字段 chartLBar.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLBar.HaveYAxis = true; //自定义设置 chartLBar.YAxis = new QMECYAxis() { AxisLabel = new QMECAxisLabel() }; chartLBar.YAxis.Type = "value"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartLBar.ValueField = "Value"; chartLBar.CateField = "Cate"; chartLBar.SubCateField = "SubCate"; chartLBar.Series = QMEChartHelper.CovertDataToSeries(chartLBar); #endregion return Content(QMEChartHelper.QMECHelper(chartLBar)); #region 自定义数据设置 //QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar1" }; //#region 设置标题 //chartLBar.Title = new QMECTitle(); //chartLBar.Title.Text = "某地区蒸发量和降水量"; //chartLBar.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //chartLBar.HaveTooltip = true; //chartLBar.Tooltip = new QMECTooltip(); //chartLBar.Tooltip.Trigger = "axis"; //#endregion //#region Legend图例设置 //chartLBar.HaveLegend = true; //chartLBar.Legend = new QMECLegend() { Data = new List() }; //chartLBar.Legend.Data.Add("蒸发量"); //chartLBar.Legend.Data.Add("降水量"); //#endregion //#region Toolbox工具栏设置 //chartLBar.HaveToolBox = true; //chartLBar.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLBar.Toolbox.Show = true; //chartLBar.Toolbox.Feature.Mark.Show = true; //chartLBar.Toolbox.Feature.MagicType.Show = true; //chartLBar.Toolbox.Feature.MagicType.Type.Add("line"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLBar.Toolbox.Feature.Restore.Show = true; //chartLBar.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //chartLBar.HaveXAxis = true; //chartLBar.XAxis = new QMECXAxis() { Data = new List() }; //chartLBar.XAxis.Type = "category"; //chartLBar.XAxis.Data.Add("一月"); //chartLBar.XAxis.Data.Add("二月"); //chartLBar.XAxis.Data.Add("三月"); //chartLBar.XAxis.Data.Add("四月"); //chartLBar.XAxis.Data.Add("五月"); //chartLBar.XAxis.Data.Add("六月"); //chartLBar.XAxis.Data.Add("七月"); //chartLBar.XAxis.Data.Add("八月"); //chartLBar.XAxis.Data.Add("九月"); //chartLBar.XAxis.Data.Add("十月"); //chartLBar.XAxis.Data.Add("十一月"); //chartLBar.XAxis.Data.Add("十二月"); //#endregion //#region YAxis纵坐标轴设置 //chartLBar.HaveYAxis = true; //chartLBar.YAxis = new QMECYAxis(); //chartLBar.YAxis.Type = "value"; //#endregion //region 设置辅助线,没有则无需要设置 //QMECMarkPoint mp = new QMECMarkPoint(); //List pointData = new List(); //List pList = new List(); //QMECPoint p1 = new QMECPoint() { Type = "max", Name = "最大值" }; //QMECPoint p2 = new QMECPoint() { Type = "min", Name = "最小值" }; //pList.Add(p1); //pList.Add(p2); //mp.Data = pList; //QMECMarkPoint mp1 = new QMECMarkPoint(); //List pointData1 = new List(); //List pList1 = new List(); //pList1.Add(new QMECPoint() { Name = "年最高", Value = 182.2, XAxis = 7, YAxis = 183, SymbolSize = 18 }); //pList1.Add(new QMECPoint() { Name = "年最低", Value = 2.3, XAxis = 11, YAxis = 3 }); //mp1.Data = pList1; //QMECMarkLine ml = new QMECMarkLine() { Data = new List() }; //ml.Data.Add(new QMECPoint() { Type = "average", Name = "平均值" }); //#endregion //#region 生成图表所需要数据格式 //chartLBar.Series = new List(); //chartLBar.Series.Add(new QMECSerie() { Name = "蒸发量", Type = "bar", Smooth = true, MarkPoint = mp, MarkLine = ml, Data = new string[] { "2.0", "4.9", "7.0", "23.2", "25.6", "76.7", "135.6", "162.2", "32.6", "20.0", "6.4", "3.3" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "降水量", Type = "bar", Smooth = true, MarkPoint = mp1, MarkLine = ml, Data = new string[] { "2.6", "5.9", "9.0", "26.4", "28.7", "70.7", "175.6", "182.2", "48.7", "18.8", "6.0", "2.3" } }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLBar)); #endregion } /// /// 下钻数据 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataSubBar1() { string Cate = Request["Cate"].ToString(); string SubCate = Request["SubCate"].ToString(); string CateName = Request["CateName"].ToString(); string SubCateName = Request["SubCateName"].ToString(); #region 源数据定义 //生成下钻数据源 List dataList = new List(); if (Cate == "zf") { dataList.Add(new TestEChartModel() { Week = "上旬", Value = "2.0", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "中旬", Value = "4.9", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "下旬", Value = "7.0", TypeValue = "蒸发量" }); } else { //"2.0", "4.9", "7.0", "23.2", "25.6", "76.7", "135.6", "162.2", "32.6", "20.0", "6.4", "3.3" dataList.Add(new TestEChartModel() { Week = "上旬", Value = "2.6", TypeValue = "降水量" }); dataList.Add(new TestEChartModel() { Week = "中旬", Value = "5.9", TypeValue = "降水量" }); dataList.Add(new TestEChartModel() { Week = "下旬", Value = "9.0", TypeValue = "降水量" }); } //"2.6", "5.9", "9.0", "26.4", "28.7", "70.7", "175.6", "182.2", "48.7", "18.8", "6.0", "2.3" #endregion #region 默认设置 QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar1" }; //设置源数据列表 chartLBar.DataList = dataList; #region 设置标题 //不为空时显示Title,为空时不显示 chartLBar.Title = new QMECTitle(); chartLBar.Title.Text = CateName + "-" + SubCateName + "-下钻数据图"; chartLBar.Title.Subtext = "纯属虚构"; #endregion #region Legend图例设置 //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLBar.LegendField = "TypeValue"; #endregion #region Tooltip提示窗口设置 //是否显示ToolTip工具条 chartLBar.HaveTooltip = true; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLBar.HaveXAxis = true; //设置X轴统计类型字段 chartLBar.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLBar.HaveYAxis = true; //自定义设置 chartLBar.YAxis = new QMECYAxis() { AxisLabel = new QMECAxisLabel() }; chartLBar.YAxis.Type = "value"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartLBar.ValueField = "Value"; chartLBar.Series = QMEChartHelper.CovertDataToSeries(chartLBar); #endregion return Content(QMEChartHelper.QMECHelper(chartLBar)); #endregion } #endregion #region 标准条形图 /// /// 标准条形图 /// /// 处理结果 [HandleException] public ActionResult Bar3() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准柱状图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataBar3() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "巴西", Value = "18203", TypeValue = "2011年" }); dataList.Add(new TestEChartModel() { Week = "印尼", Value = "23489", TypeValue = "2011年" }); dataList.Add(new TestEChartModel() { Week = "美国", Value = "29034", TypeValue = "2011年" }); dataList.Add(new TestEChartModel() { Week = "印度", Value = "104970", TypeValue = "2011年" }); dataList.Add(new TestEChartModel() { Week = "中国", Value = "131744", TypeValue = "2011年" }); dataList.Add(new TestEChartModel() { Week = "世界人口(万)", Value = "630230", TypeValue = "2011年" }); //"18203", "23489", "29034", "104970", "131744", "630230" dataList.Add(new TestEChartModel() { Week = "巴西", Value = "19325", TypeValue = "2012年" }); dataList.Add(new TestEChartModel() { Week = "印尼", Value = "23438", TypeValue = "2012年" }); dataList.Add(new TestEChartModel() { Week = "美国", Value = "31000", TypeValue = "2012年" }); dataList.Add(new TestEChartModel() { Week = "印度", Value = "121594", TypeValue = "2012年" }); dataList.Add(new TestEChartModel() { Week = "中国", Value = "134141", TypeValue = "2012年" }); dataList.Add(new TestEChartModel() { Week = "世界人口(万)", Value = "681807", TypeValue = "2012年" }); //"19325", "23438", "31000", "121594", "134141", "681807" #endregion #region 默认设置 QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar3" }; //设置源数据列表 chartLBar.DataList = dataList; #region 设置标题 //不为空时显示Title,为空时不显示 chartLBar.Title = new QMECTitle(); chartLBar.Title.Text = "世界人口总量"; chartLBar.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 //是否显示ToolTip工具条 chartLBar.HaveTooltip = true; #endregion #region Legend图例设置 //是否有Legend chartLBar.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLBar.LegendField = "TypeValue"; #endregion #region Toolbox工具栏设置 //是否存在工具栏,为空时使用默认设置 chartLBar.HaveToolBox = true; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLBar.HaveXAxis = true; #endregion #region YAxis纵坐标轴设置 //设置分类字段 chartLBar.YAxis.Type = "category"; //设置X轴统计类型字段 chartLBar.YAxisField = "Week"; //设置Y轴显示格式。 chartLBar.HaveYAxis = true; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartLBar.ValueField = "Value"; chartLBar.Series = QMEChartHelper.CovertDataToSeries(chartLBar); #endregion return Content(QMEChartHelper.QMECHelper(chartLBar)); #endregion #region 自定义创建图表 //QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar3" }; //#region 设置标题 //chartLBar.Title = new QMECTitle(); //chartLBar.Title.Text = "世界人口总量"; //chartLBar.Title.Subtext = "数据来自网络"; //#endregion //#region Tooltip提示窗口设置 //chartLBar.HaveTooltip = true; //chartLBar.Tooltip = new QMECTooltip(); //chartLBar.Tooltip.Trigger = "axis"; //#endregion //#region Legend图例设置 //chartLBar.HaveLegend = true; //chartLBar.Legend = new QMECLegend() { Data = new List() }; //chartLBar.Legend.Data.Add("2011年"); //chartLBar.Legend.Data.Add("2012年"); //#endregion //#region Toolbox工具栏设置 //chartLBar.HaveToolBox = true; //chartLBar.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLBar.Toolbox.Show = true; //chartLBar.Toolbox.Feature.Mark.Show = true; //chartLBar.Toolbox.Feature.MagicType.Show = true; //chartLBar.Toolbox.Feature.MagicType.Type.Add("line"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLBar.Toolbox.Feature.Restore.Show = true; //chartLBar.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //chartLBar.HaveXAxis = true; //chartLBar.XAxis = new QMECXAxis() { Data = new List() }; //chartLBar.XAxis.Type = "value"; //chartLBar.XAxis.BoundaryGap = "[0,0.01]".ToCharArray(); //#endregion //#region YAxis纵坐标轴设置 //chartLBar.HaveYAxis = true; //chartLBar.YAxis = new QMECYAxis() { Data = new List()}; //chartLBar.YAxis.Type = "category"; //chartLBar.YAxis.Data.Add("巴西"); //chartLBar.YAxis.Data.Add("印尼"); //chartLBar.YAxis.Data.Add("美国"); //chartLBar.YAxis.Data.Add("印度"); //chartLBar.YAxis.Data.Add("中国"); //chartLBar.YAxis.Data.Add("世界人口(万)"); //#endregion //#region 生成图表所需要数据格式 //chartLBar.Series = new List(); //chartLBar.Series.Add(new QMECSerie() { Name = "2011年", Type = "bar", Data = new string[] { "18203", "23489", "29034", "104970", "131744", "630230" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "2012年", Type = "bar", Data = new string[] { "19325", "23438", "31000", "121594", "134141", "681807" } }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLBar)); #endregion } #endregion #region 堆积柱状图 /// /// 堆积柱状图 /// /// 处理结果 [HandleException] public ActionResult Bar2() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 堆积柱状图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataBar2() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "周一", Value = "320", TypeValue = "直接访问", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "332", TypeValue = "直接访问", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "301", TypeValue = "直接访问", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "334", TypeValue = "直接访问", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "390", TypeValue = "直接访问", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "330", TypeValue = "直接访问", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "320", TypeValue = "直接访问", StackValue = "" }); //"320", "332", "301", "334", "390", "330", "320" dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "邮件营销", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "邮件营销", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "101", TypeValue = "邮件营销", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "134", TypeValue = "邮件营销", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "90", TypeValue = "邮件营销", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "230", TypeValue = "邮件营销", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "210", TypeValue = "邮件营销", StackValue = "广告" }); //"120", "132", "101", "134", "90", "230", "210" dataList.Add(new TestEChartModel() { Week = "周一", Value = "220", TypeValue = "联盟广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "182", TypeValue = "联盟广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "191", TypeValue = "联盟广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "234", TypeValue = "联盟广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "290", TypeValue = "联盟广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "330", TypeValue = "联盟广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "310", TypeValue = "联盟广告", StackValue = "广告" }); //"220", "182", "191", "234", "290", "330", "310" dataList.Add(new TestEChartModel() { Week = "周一", Value = "150", TypeValue = "视频广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "232", TypeValue = "视频广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "201", TypeValue = "视频广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "154", TypeValue = "视频广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "190", TypeValue = "视频广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "330", TypeValue = "视频广告", StackValue = "广告" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "410", TypeValue = "视频广告", StackValue = "广告" }); //"150", "232", "201", "154", "190", "330", "410" dataList.Add(new TestEChartModel() { Week = "周一", Value = "862", TypeValue = "搜索引擎", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "1018", TypeValue = "搜索引擎", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "964", TypeValue = "搜索引擎", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "1026", TypeValue = "搜索引擎", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "1679", TypeValue = "搜索引擎", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "1600", TypeValue = "搜索引擎", StackValue = "" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "1570", TypeValue = "搜索引擎", StackValue = "" }); //"862", "1018", "964", "1026", "1679", "1600", "1570" dataList.Add(new TestEChartModel() { Week = "周一", Value = "620", TypeValue = "百度", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "732", TypeValue = "百度", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "701", TypeValue = "百度", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "734", TypeValue = "百度", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "1090", TypeValue = "百度", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "1130", TypeValue = "百度", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "1120", TypeValue = "百度", StackValue = "搜索引擎" }); //"620", "732", "701", "734", "1090", "1130", "1120" dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "谷歌", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "谷歌", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "101", TypeValue = "谷歌", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "134", TypeValue = "谷歌", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "290", TypeValue = "谷歌", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "230", TypeValue = "谷歌", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "220", TypeValue = "谷歌", StackValue = "搜索引擎" }); //"120", "132", "101", "134", "290", "230", "220" dataList.Add(new TestEChartModel() { Week = "周一", Value = "60", TypeValue = "必应", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "72", TypeValue = "必应", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "71", TypeValue = "必应", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "74", TypeValue = "必应", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "190", TypeValue = "必应", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "130", TypeValue = "必应", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "110", TypeValue = "必应", StackValue = "搜索引擎" }); //"60", "72", "71", "74", "190", "130", "110" dataList.Add(new TestEChartModel() { Week = "周一", Value = "62", TypeValue = "其他", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "82", TypeValue = "其他", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "91", TypeValue = "其他", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "84", TypeValue = "其他", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "109", TypeValue = "其他", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "110", TypeValue = "其他", StackValue = "搜索引擎" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "120", TypeValue = "其他", StackValue = "搜索引擎" }); //"62", "82", "91", "84", "109", "110", "120" #endregion #region 默认设置 QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar2" }; //设置源数据列表 chartLBar.DataList = dataList; #region 设置标题 //不为空时显示Title,为空时不显示 chartLBar.Title = new QMECTitle(); chartLBar.Title.Text = "世界人口总量"; chartLBar.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 //是否显示ToolTip工具条 chartLBar.HaveTooltip = true; #endregion #region Legend图例设置 //是否有Legend chartLBar.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLBar.LegendField = "TypeValue"; #endregion #region Toolbox工具栏设置 //是否存在工具栏,为空时使用默认设置 chartLBar.HaveToolBox = true; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLBar.HaveXAxis = true; //设置X轴统计类型字段 chartLBar.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLBar.HaveYAxis = true; //自定义设置 chartLBar.YAxis = new QMECYAxis() { AxisLabel = new QMECAxisLabel() }; chartLBar.YAxis.Type = "value"; #endregion #region 堆积字段设置 //堆积字段,是否是堆积图形 chartLBar.StackField = "StackValue"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartLBar.ValueField = "Value"; chartLBar.Series = QMEChartHelper.CovertDataToSeries(chartLBar); #endregion #region 辅助线设置,有则设置,没有则无需设置 //设置辅助线 QMECMarkLine ml = new QMECMarkLine() { ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { LineStyle = new QMECLineStyle() } }, LineData = new List() }; ml.ItemStyle.Normal.LineStyle = new QMECLineStyle() { Type = "dashed", Width = 1 }; List mp = new List(); QMECPoint mpstart = new QMECPoint(); QMECPoint mpend = new QMECPoint(); mpstart.Type = "min"; mpend.Type = "max"; ml.LineData.Add(mpstart); ml.LineData.Add(mpend); foreach (QMECSerie ser in chartLBar.Series) { if (ser.Name == "搜索引擎") { ser.MarkLine = ml; } } #endregion return Content(QMEChartHelper.QMECHelper(chartLBar)); #endregion #region 自定义创建图表 //QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar2" }; //#region Tooltip提示窗口设置 //chartLBar.HaveTooltip = true; //chartLBar.Tooltip = new QMECTooltip() { AxisPointer = new QMECAxisPointer() }; //chartLBar.Tooltip.Trigger = "axis"; //chartLBar.Tooltip.AxisPointer.Type = "shadow"; //#endregion //#region Legend图例设置 //chartLBar.HaveLegend = true; //chartLBar.Legend = new QMECLegend() { Data = new List() }; //chartLBar.Legend.Data.Add("直接访问"); //chartLBar.Legend.Data.Add("邮件营销"); //chartLBar.Legend.Data.Add("联盟广告"); //chartLBar.Legend.Data.Add("视频广告"); //chartLBar.Legend.Data.Add("搜索引擎"); //chartLBar.Legend.Data.Add("百度"); //chartLBar.Legend.Data.Add("谷歌"); //chartLBar.Legend.Data.Add("必应"); //chartLBar.Legend.Data.Add("其他"); //#endregion //#region Toolbox工具栏设置 //chartLBar.HaveToolBox = true; //chartLBar.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLBar.Toolbox.Show = true; //chartLBar.Toolbox.Orient = "vertical"; //chartLBar.Toolbox.X = "right"; //chartLBar.Toolbox.Y = "center"; //chartLBar.Toolbox.Feature.Mark.Show = true; //chartLBar.Toolbox.Feature.MagicType.Show = true; //chartLBar.Toolbox.Feature.MagicType.Type.Add("line"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("stack"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("tiled"); //chartLBar.Toolbox.Feature.Restore.Show = true; //chartLBar.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //chartLBar.HaveXAxis = true; //chartLBar.XAxis = new QMECXAxis() { Data = new List() }; //chartLBar.XAxis.Type = "category"; //chartLBar.XAxis.Data.Add("周一"); //chartLBar.XAxis.Data.Add("周二"); //chartLBar.XAxis.Data.Add("周三"); //chartLBar.XAxis.Data.Add("周四"); //chartLBar.XAxis.Data.Add("周五"); //chartLBar.XAxis.Data.Add("周六"); //chartLBar.XAxis.Data.Add("周日"); //#endregion //#region YAxis纵坐标轴设置 //chartLBar.HaveYAxis = true; //chartLBar.YAxis = new QMECYAxis() { Data = new List() }; //chartLBar.YAxis.Type = "value"; //#endregion //#region 生成辅助线 //QMECMarkLine ml = new QMECMarkLine() { ItemStyle = new QMECItemStyle() { Normal = new QMECNormal() { LineStyle = new QMECLineStyle() } }, LineData = new List() }; //ml.ItemStyle.Normal.LineStyle = new QMECLineStyle() { Type = "dashed", Width = 1 }; //List mp = new List(); //QMECPoint mpstart = new QMECPoint(); //QMECPoint mpend = new QMECPoint(); //mpstart.Type = "min"; //mpend.Type = "max"; //ml.LineData.Add(mpstart); //ml.LineData.Add(mpend); //#endregion //#region 生成图表所需要数据格式 //chartLBar.Series = new List(); //chartLBar.Series.Add(new QMECSerie() { Name = "直接访问", Type = "bar", Stack = "", Data = new string[] { "320", "332", "301", "334", "390", "330", "320" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "邮件营销", Type = "bar", Stack = "广告", Data = new string[] { "120", "132", "101", "134", "90", "230", "210" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "联盟广告", Type = "bar", Stack = "广告", Data = new string[] { "220", "182", "191", "234", "290", "330", "310" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "视频广告", Type = "bar", Stack = "广告", Data = new string[] { "150", "232", "201", "154", "190", "330", "410" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "搜索引擎", Type = "bar", MarkLine = ml, Data = new string[] { "862", "1018", "964", "1026", "1679", "1600", "1570" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "百度", Type = "bar", BarWidth = "5", Stack = "搜索引擎", Data = new string[] { "620", "732", "701", "734", "1090", "1130", "1120" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "谷歌", Type = "bar", Stack = "搜索引擎", Data = new string[] { "120", "132", "101", "134", "290", "230", "220" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "必应", Type = "bar", Stack = "搜索引擎", Data = new string[] { "60", "72", "71", "74", "190", "130", "110" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "其他", Type = "bar", Stack = "搜索引擎", Data = new string[] { "62", "82", "91", "84", "109", "110", "120" } }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLBar)); #endregion } #endregion #region 堆积条形图 /// /// 堆积条形图 /// /// 处理结果 [HandleException] public ActionResult Bar4() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 堆积条形图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataBar4() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "周一", Value = "320", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "332", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "301", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "334", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "390", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "330", TypeValue = "直接访问", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "320", TypeValue = "直接访问", StackValue = "总量" }); //"320", "332", "301", "334", "390", "330", "320" dataList.Add(new TestEChartModel() { Week = "周一", Value = "120", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "132", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "101", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "134", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "90", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "230", TypeValue = "邮件营销", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "210", TypeValue = "邮件营销", StackValue = "总量" }); //"120", "132", "101", "134", "90", "230", "210" dataList.Add(new TestEChartModel() { Week = "周一", Value = "220", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "182", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "191", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "234", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "290", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "330", TypeValue = "联盟广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "310", TypeValue = "联盟广告", StackValue = "总量" }); //"220", "182", "191", "234", "290", "330", "310" dataList.Add(new TestEChartModel() { Week = "周一", Value = "150", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "232", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "201", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "154", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "190", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "330", TypeValue = "视频广告", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "410", TypeValue = "视频广告", StackValue = "总量" }); //"150", "232", "201", "154", "190", "330", "410" dataList.Add(new TestEChartModel() { Week = "周一", Value = "862", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周二", Value = "1018", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周三", Value = "964", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周四", Value = "1026", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周五", Value = "1679", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周六", Value = "1600", TypeValue = "搜索引擎", StackValue = "总量" }); dataList.Add(new TestEChartModel() { Week = "周日", Value = "1570", TypeValue = "搜索引擎", StackValue = "总量" }); //"862", "1018", "964", "1026", "1679", "1600", "1570" #endregion #region 默认设置 QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar4" }; //设置源数据列表 chartLBar.DataList = dataList; #region 设置标题 //不为空时显示Title,为空时不显示 chartLBar.Title = new QMECTitle(); chartLBar.Title.Text = "营销渠道统计"; chartLBar.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 //是否显示ToolTip工具条 chartLBar.HaveTooltip = true; #endregion #region Legend图例设置 //是否有Legend chartLBar.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLBar.LegendField = "TypeValue"; #endregion #region Toolbox工具栏设置 //是否存在工具栏,为空时使用默认设置 chartLBar.HaveToolBox = true; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLBar.HaveXAxis = true; #endregion #region XAxis横坐标轴设置 //设置分类字段 chartLBar.YAxis.Type = "category"; //设置X轴统计类型字段 chartLBar.YAxisField = "Week"; //设置Y轴显示格式。 chartLBar.HaveYAxis = true; #endregion #region 设置堆积字段 //堆积字段,是否是堆积图形 chartLBar.StackField = "StackValue"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartLBar.ValueField = "Value"; chartLBar.Series = QMEChartHelper.CovertDataToSeries(chartLBar); #endregion return Content(QMEChartHelper.QMECHelper(chartLBar)); #endregion #region 自定义创建图表 //QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar4" }; //chartLBar.HaveTooltip = true; //chartLBar.Tooltip = new QMECTooltip() { AxisPointer = new QMECAxisPointer() }; //chartLBar.Tooltip.Trigger = "axis"; //chartLBar.Tooltip.AxisPointer.Type = "shadow"; //chartLBar.HaveLegend = true; //chartLBar.Legend = new QMECLegend() { Data = new List() }; //chartLBar.Legend.Data.Add("直接访问"); //chartLBar.Legend.Data.Add("邮件营销"); //chartLBar.Legend.Data.Add("联盟广告"); //chartLBar.Legend.Data.Add("视频广告"); //chartLBar.Legend.Data.Add("搜索引擎"); //chartLBar.HaveToolBox = true; //chartLBar.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List() }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartLBar.Toolbox.Show = true; //chartLBar.Toolbox.Feature.Mark.Show = true; //chartLBar.Toolbox.Feature.MagicType.Show = true; //chartLBar.Toolbox.Feature.MagicType.Type.Add("line"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("bar"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("stack"); //chartLBar.Toolbox.Feature.MagicType.Type.Add("tiled"); //chartLBar.Toolbox.Feature.Restore.Show = true; //chartLBar.Toolbox.Feature.SaveAsImage.Show = true; //chartLBar.HaveYAxis = true; //chartLBar.YAxis = new QMECYAxis() { Data = new List() }; //chartLBar.YAxis.Type = "category"; //chartLBar.YAxis.Data.Add("周一"); //chartLBar.YAxis.Data.Add("周二"); //chartLBar.YAxis.Data.Add("周三"); //chartLBar.YAxis.Data.Add("周四"); //chartLBar.YAxis.Data.Add("周五"); //chartLBar.YAxis.Data.Add("周六"); //chartLBar.YAxis.Data.Add("周日"); //chartLBar.HaveXAxis = true; //chartLBar.XAxis = new QMECXAxis() { Data = new List() }; //chartLBar.XAxis.Type = "value"; //QMECItemStyle itemStyle = new QMECItemStyle() { Normal = new QMECNormal() { Label = new QMECLabel() } }; //itemStyle.Normal.Label.Show = true; //itemStyle.Normal.Label.Position = "insideRight"; //chartLBar.Series = new List(); //chartLBar.Series.Add(new QMECSerie() { Name = "直接访问", Type = "bar", Stack = "总量", ItemStyle = itemStyle, Data = new string[] { "320", "302", "301", "334", "390", "330", "320" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "邮件营销", Type = "bar", Stack = "总量", ItemStyle = itemStyle, Data = new string[] { "120", "132", "101", "134", "90", "230", "210" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "联盟广告", Type = "bar", Stack = "总量", ItemStyle = itemStyle, Data = new string[] { "220", "182", "191", "234", "290", "330", "310" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "视频广告", Type = "bar", Stack = "总量", ItemStyle = itemStyle, Data = new string[] { "150", "212", "201", "154", "190", "330", "410" } }); //chartLBar.Series.Add(new QMECSerie() { Name = "搜索引擎", Type = "bar", Stack = "总量", ItemStyle = itemStyle, Data = new string[] { "820", "832", "901", "934", "1290", "1330", "1320" } }); //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartLBar)); #endregion } #endregion #region 标准饼图 /// /// 标准饼图 /// /// 处理结果 [HandleException] public ActionResult Pie1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准饼图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataPie1() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Value = "335", TypeValue = "直接访问" }); dataList.Add(new TestEChartModel() { Value = "320", TypeValue = "邮件营销" }); dataList.Add(new TestEChartModel() { Value = "310", TypeValue = "联盟广告" }); dataList.Add(new TestEChartModel() { Value = "135", TypeValue = "视频广告" }); dataList.Add(new TestEChartModel() { Value = "1548", TypeValue = "搜索引擎" }); #endregion #region 默认设置 QMEChartPie chartPie = new QMEChartPie() { PieType = "pie1" }; //设置数据源 chartPie.DataList = dataList; #region 设置标题 //标题有则显示。不设置为不显示标题 chartPie.Title = new QMECTitle(); chartPie.Title.Text = "某站点用户访问来源"; chartPie.Title.Subtext = "纯属虚构"; chartPie.Title.X = "center";//对齐方式 #endregion #region Tooltip提示窗口设置 //是否显示ToolTip设置使用默认值初始化图形 chartPie.HaveTooltip = true; #endregion #region Legend图例设置 //是否生成Legend,不设置使用系统默认值 chartPie.HaveLegend = true; chartPie.LegendField = "TypeValue"; #endregion #region Toolbox工具栏设置 //是否生成ToolBox,不设置使用系统默认值 chartPie.HaveToolBox = true; #endregion //是否启用拖拽重计算特性 chartPie.Calculable = true; #region 设置Serie显示标题 chartPie.SerieName = "访问来源"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartPie.ValueField = "Value"; chartPie.PieData = QMEChartHelper.CovertDataToPieData(chartPie); #endregion return Content(QMEChartHelper.QMECHelper(chartPie)); #endregion #region 自定义创建图表 //QMEChartPie chartPie = new QMEChartPie() { PieType = "pie1" }; //#region 设置标题 //chartPie.Title = new QMECTitle(); //chartPie.Title.Text = "某站点用户访问来源"; //chartPie.Title.Subtext = "纯属虚构"; //chartPie.Title.X = "center";//对齐方式 //#endregion //#region Tooltip提示窗口设置 //chartPie.HaveTooltip = true; //chartPie.Tooltip = new QMECTooltip(); //chartPie.Tooltip.Trigger = "item"; //chartPie.Tooltip.Formatter = "'{a}
{b} : {c} ({d}%)'"; //#endregion //#region Legend图例设置 //chartPie.HaveLegend = true; //chartPie.Legend = new QMECLegend() { Data = new List() }; //chartPie.Legend.Orient = "vertical"; //chartPie.Legend.X = "left"; //chartPie.Legend.Data.Add("直接访问"); //chartPie.Legend.Data.Add("邮件营销"); //chartPie.Legend.Data.Add("联盟广告"); //chartPie.Legend.Data.Add("视频广告"); //chartPie.Legend.Data.Add("搜索引擎"); //#endregion //#region Toolbox工具栏设置 //chartPie.HaveToolBox = true; //chartPie.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List(), Option = new QMECOption() { Funnel = new QMECFunnel() } }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartPie.Toolbox.Show = true; //chartPie.Toolbox.Feature.Mark.Show = true; //chartPie.Toolbox.Feature.MagicType.Show = true; //chartPie.Toolbox.Feature.MagicType.Type.Add("pie"); //chartPie.Toolbox.Feature.MagicType.Type.Add("funnel"); //chartPie.Toolbox.Feature.MagicType.Option.Funnel.X = "25%"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.Width = "50%"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.FunnelAlign = "left"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.Max = "1548"; //chartPie.Toolbox.Feature.Restore.Show = true; //chartPie.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //chartPie.Calculable = true; //#region 生成图表所需要数据格式 //chartPie.Serie = new QMECSerie(); //chartPie.Serie.PieData = "Auto"; //chartPie.Serie.Name = "访问来源"; //chartPie.Serie.Radius = "55%"; //chartPie.Serie.Type = "pie"; //chartPie.Serie.Center_X = "50%"; //chartPie.Serie.Center_Y = "60%"; //chartPie.Serie.Center = "Auto"; //List pieData = new List(); //pieData.Add(new QMECPieData() { Value = "335", Name = "直接访问" }); //pieData.Add(new QMECPieData() { Value = "310", Name = "邮件营销" }); //pieData.Add(new QMECPieData() { Value = "234", Name = "联盟广告" }); //pieData.Add(new QMECPieData() { Value = "135", Name = "视频广告" }); //pieData.Add(new QMECPieData() { Value = "1548", Name = "搜索引擎" }); //chartPie.PieData = pieData; //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartPie)); #endregion } /// /// 标准饼图 /// /// 处理结果 [HandleException] public ActionResult GetEchartSubDataPie1(string id) { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Value = "335", TypeValue = "百度" }); dataList.Add(new TestEChartModel() { Value = "320", TypeValue = "360" }); dataList.Add(new TestEChartModel() { Value = "310", TypeValue = "IE" }); dataList.Add(new TestEChartModel() { Value = "1350", TypeValue = "火狐" }); dataList.Add(new TestEChartModel() { Value = "548", TypeValue = "谷歌" }); #endregion #region 默认设置 QMEChartPie chartPie = new QMEChartPie() { PieType = "pie1" }; //设置数据源 chartPie.DataList = dataList; #region 设置标题 //标题有则显示。不设置为不显示标题 chartPie.Title = new QMECTitle(); chartPie.Title.Text = "某站点用户访问来源"; chartPie.Title.Subtext = "纯属虚构"; chartPie.Title.X = "center";//对齐方式 #endregion #region Tooltip提示窗口设置 //是否显示ToolTip设置使用默认值初始化图形 chartPie.HaveTooltip = true; #endregion #region Legend图例设置 //是否生成Legend,不设置使用系统默认值 chartPie.HaveLegend = true; chartPie.LegendField = "TypeValue"; #endregion #region Toolbox工具栏设置 //是否生成ToolBox,不设置使用系统默认值 chartPie.HaveToolBox = true; #endregion //是否启用拖拽重计算特性 chartPie.Calculable = true; #region 设置Serie显示标题 chartPie.SerieName = "访问来源"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartPie.ValueField = "Value"; chartPie.PieData = QMEChartHelper.CovertDataToPieData(chartPie); #endregion return Content(QMEChartHelper.QMECHelper(chartPie)); #endregion #region 自定义创建图表 //QMEChartPie chartPie = new QMEChartPie() { PieType = "pie1" }; //#region 设置标题 //chartPie.Title = new QMECTitle(); //chartPie.Title.Text = "某站点用户访问来源"; //chartPie.Title.Subtext = "纯属虚构"; //chartPie.Title.X = "center";//对齐方式 //#endregion //#region Tooltip提示窗口设置 //chartPie.HaveTooltip = true; //chartPie.Tooltip = new QMECTooltip(); //chartPie.Tooltip.Trigger = "item"; //chartPie.Tooltip.Formatter = "'{a}
{b} : {c} ({d}%)'"; //#endregion //#region Legend图例设置 //chartPie.HaveLegend = true; //chartPie.Legend = new QMECLegend() { Data = new List() }; //chartPie.Legend.Orient = "vertical"; //chartPie.Legend.X = "left"; //chartPie.Legend.Data.Add("直接访问"); //chartPie.Legend.Data.Add("邮件营销"); //chartPie.Legend.Data.Add("联盟广告"); //chartPie.Legend.Data.Add("视频广告"); //chartPie.Legend.Data.Add("搜索引擎"); //#endregion //#region Toolbox工具栏设置 //chartPie.HaveToolBox = true; //chartPie.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List(), Option = new QMECOption() { Funnel = new QMECFunnel() } }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartPie.Toolbox.Show = true; //chartPie.Toolbox.Feature.Mark.Show = true; //chartPie.Toolbox.Feature.MagicType.Show = true; //chartPie.Toolbox.Feature.MagicType.Type.Add("pie"); //chartPie.Toolbox.Feature.MagicType.Type.Add("funnel"); //chartPie.Toolbox.Feature.MagicType.Option.Funnel.X = "25%"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.Width = "50%"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.FunnelAlign = "left"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.Max = "1548"; //chartPie.Toolbox.Feature.Restore.Show = true; //chartPie.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //chartPie.Calculable = true; //#region 生成图表所需要数据格式 //chartPie.Serie = new QMECSerie(); //chartPie.Serie.PieData = "Auto"; //chartPie.Serie.Name = "访问来源"; //chartPie.Serie.Radius = "55%"; //chartPie.Serie.Type = "pie"; //chartPie.Serie.Center_X = "50%"; //chartPie.Serie.Center_Y = "60%"; //chartPie.Serie.Center = "Auto"; //List pieData = new List(); //pieData.Add(new QMECPieData() { Value = "335", Name = "直接访问" }); //pieData.Add(new QMECPieData() { Value = "310", Name = "邮件营销" }); //pieData.Add(new QMECPieData() { Value = "234", Name = "联盟广告" }); //pieData.Add(new QMECPieData() { Value = "135", Name = "视频广告" }); //pieData.Add(new QMECPieData() { Value = "1548", Name = "搜索引擎" }); //chartPie.PieData = pieData; //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartPie)); #endregion } #endregion #region 标准环形图 /// /// 标准环形图 /// /// 处理结果 [HandleException] public ActionResult Pie2() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准环形图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataPie2() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Value = "335", TypeValue = "直接访问" }); dataList.Add(new TestEChartModel() { Value = "320", TypeValue = "邮件营销" }); dataList.Add(new TestEChartModel() { Value = "310", TypeValue = "联盟广告" }); dataList.Add(new TestEChartModel() { Value = "135", TypeValue = "视频广告" }); dataList.Add(new TestEChartModel() { Value = "1548", TypeValue = "搜索引擎" }); #endregion #region 默认设置 QMEChartPie chartPie = new QMEChartPie() { PieType = "pie2" }; //设置数据源 chartPie.DataList = dataList; #region 设置标题 chartPie.Title = new QMECTitle(); chartPie.Title.Text = "某站点用户访问来源"; chartPie.Title.Subtext = "纯属虚构"; chartPie.Title.X = "center";//对齐方式 #endregion #region Tooltip提示窗口设置 //是否显示ToolTip设置使用默认值初始化图形 chartPie.HaveTooltip = true; #endregion #region Legend图例设置 //是否生成Legend,不设置使用系统默认值 chartPie.HaveLegend = true; chartPie.LegendField = "TypeValue"; #endregion #region Toolbox工具栏设置 //是否生成ToolBox,不设置使用系统默认值 chartPie.HaveToolBox = true; #endregion #region 生成图表所需要数据格式 chartPie.SerieName = "访问来源"; //转换数据格式,值字段 chartPie.ValueField = "Value"; chartPie.PieData = QMEChartHelper.CovertDataToPieData(chartPie); #endregion return Content(QMEChartHelper.QMECHelper(chartPie)); #endregion //QMEChartPie chartPie = new QMEChartPie() { PieType = "pie2" }; //#region 设置标题 //chartPie.Title = new QMECTitle(); //chartPie.Title.Text = "某站点用户访问来源"; //chartPie.Title.Subtext = "纯属虚构"; //chartPie.Title.X = "center";//对齐方式 //#endregion //#region Tooltip提示窗口设置 //chartPie.HaveTooltip = true; //chartPie.Tooltip = new QMECTooltip(); //chartPie.Tooltip.Trigger = "item"; //chartPie.Tooltip.Formatter = "'{a}
{b} : {c} ({d}%)'"; //#endregion //#region Legend图例设置 //chartPie.HaveLegend = true; //chartPie.Legend = new QMECLegend() { Data = new List() }; //chartPie.Legend.Orient = "vertical"; //chartPie.Legend.X = "left"; //chartPie.Legend.Data.Add("直接访问"); //chartPie.Legend.Data.Add("邮件营销"); //chartPie.Legend.Data.Add("联盟广告"); //chartPie.Legend.Data.Add("视频广告"); //chartPie.Legend.Data.Add("搜索引擎"); //#endregion //#region Toolbox工具栏设置 //chartPie.HaveToolBox = true; //chartPie.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), MagicType = new QMECMagicType() { Type = new List(), Option = new QMECOption() { Funnel = new QMECFunnel() } }, Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartPie.Toolbox.Show = true; //chartPie.Toolbox.Feature.Mark.Show = true; //chartPie.Toolbox.Feature.MagicType.Show = true; //chartPie.Toolbox.Feature.MagicType.Type.Add("pie"); //chartPie.Toolbox.Feature.MagicType.Type.Add("funnel"); //chartPie.Toolbox.Feature.MagicType.Option.Funnel.X = "25%"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.Width = "50%"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.FunnelAlign = "left"; //chartPie.Toolbox.Feature.MagicType.Option.Funnel.Max = "1548"; //chartPie.Toolbox.Feature.Restore.Show = true; //chartPie.Toolbox.Feature.SaveAsImage.Show = true; //#endregion ////是否启用拖拽重计算特性 //chartPie.Calculable = true; //#region 生成图表所需要数据格式 //chartPie.Serie = new QMECSerie(); //chartPie.Serie.Name = "访问来源"; //chartPie.Serie.Radius_Min = "55%"; //chartPie.Serie.Radius_Max = "70%"; //chartPie.Serie.Radius = "Auto"; //chartPie.Serie.Type = "pie"; //chartPie.Serie.PieData = "Auto"; //QMECItemStyle itemStyle = new QMECItemStyle() { Normal = new QMECNormal() { Label = new QMECLabel(),LabelLine = new QMECLabelLine() } }; //itemStyle.Normal.Label.Show = true; //itemStyle.Normal.LabelLine.Show = true; //itemStyle.Emphasis = new QMECEmphasis() { Label = new QMECLabel() { TextStyle = new QMECTextStyle()} }; //itemStyle.Emphasis.Label.Show = true; //itemStyle.Emphasis.Label.Position = "center"; //itemStyle.Emphasis.Label.TextStyle.fontSize = "30"; //itemStyle.Emphasis.Label.TextStyle.fontWeight = "bold"; //chartPie.Serie.ItemStyle = itemStyle; //List pieData = new List(); //pieData.Add(new QMECPieData() { Value = "335", Name = "直接访问" }); //pieData.Add(new QMECPieData() { Value = "310", Name = "邮件营销" }); //pieData.Add(new QMECPieData() { Value = "234", Name = "联盟广告" }); //pieData.Add(new QMECPieData() { Value = "135", Name = "视频广告" }); //pieData.Add(new QMECPieData() { Value = "1548", Name = "搜索引擎" }); //chartPie.PieData = pieData; //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartPie)); } #endregion #region 标准地图 /// /// 标准地图 /// /// 处理结果 [HandleException] public ActionResult Map1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准环形图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataMap1() { #region 自定义创建图表 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "北京", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "天津", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "上海", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "重庆", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "河北", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "河南", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "云南", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "辽宁", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "黑龙江", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "湖南", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "安徽", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "山东", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "新疆", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "江苏", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "浙江", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "江西", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "湖北", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "广西", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "甘肃", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "山西", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "内蒙古", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "陕西", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "吉林", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "福建", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "贵州", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "广东", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "青海", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "西藏", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "四川", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "宁夏", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "海南", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "台湾", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "香港", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone3", TypeValue = "澳门", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "北京", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "天津", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "上海", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "重庆", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "河北", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "安徽", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "新疆", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "浙江", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "江西", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "山西", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "内蒙古", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "吉林", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "福建", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "广东", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "西藏", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "四川", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "宁夏", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "香港", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone4", TypeValue = "澳门", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone5", TypeValue = "北京", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone5", TypeValue = "天津", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone5", TypeValue = "上海", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone5", TypeValue = "台湾", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); dataList.Add(new TestEChartModel() { Name = "iphone5", TypeValue = "香港", Value = Math.Round(new Random().NextDouble() * 1000) + "" }); #endregion #region 默认设置 QMEChartMap chartMap = new QMEChartMap() { MapType = "map1" }; chartMap.DataList = dataList; #region 设置标题 //不为空时设置标题 chartMap.Title = new QMECTitle(); chartMap.Title.Text = "iphone销量"; chartMap.Title.Subtext = "纯属虚构"; chartMap.Title.X = "center";//对齐方式 #endregion #region Tooltip提示窗口设置 //是否显示ToolTip设置使用默认值初始化图形 chartMap.HaveTooltip = true; #endregion #region Legend图例设置 //是否生成Legend,不设置使用系统默认值 chartMap.HaveLegend = true; chartMap.LegendField = "Name"; #endregion #region 设置数据范围工具条 chartMap.HaveDataRange = true; #endregion #region Toolbox工具栏设置 chartMap.HaveToolBox = true; #endregion chartMap.Calculable = true; #region 设置地图缩放工具条 chartMap.HaveRoamController = true; #endregion #region 设置堆积字段 chartMap.StackField = "TypeValue"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartMap.ValueField = "Value"; chartMap.Series = QMEChartHelper.CovertDataToSeries(chartMap); #endregion return Content(QMEChartHelper.QMECHelper(chartMap)); #endregion #region 自定义创建图表 //QMEChartMap chartMap = new QMEChartMap() { MapType = "map1" }; //#region 设置标题 //chartMap.Title = new QMECTitle(); //chartMap.Title.Text = "iphone销量"; //chartMap.Title.Subtext = "纯属虚构"; //chartMap.Title.X = "center";//对齐方式 //#endregion //#region Tooltip提示窗口设置 ////Tooltip提示窗口设置 //chartMap.HaveTooltip = true; //chartMap.Tooltip = new QMECTooltip(); //chartMap.Tooltip.Trigger = "item"; //#endregion //#region Legend图例设置 //chartMap.HaveLegend = true; //chartMap.Legend = new QMECLegend() { Data = new List() }; //chartMap.Legend.Orient = "vertical"; //chartMap.Legend.X = "left"; //chartMap.Legend.Data.Add("iphone3"); //chartMap.Legend.Data.Add("iphone4"); //chartMap.Legend.Data.Add("iphone5"); //#endregion //#region 设置数据范围工具条 //chartMap.HaveDataRange = true; //chartMap.dataRange = new QMECDataRange(); //chartMap.dataRange.Min = 0; //chartMap.dataRange.Max = 2500; //chartMap.dataRange.X = "left"; //chartMap.dataRange.Y = "bottom"; //chartMap.dataRange.Text_Min = "低"; //chartMap.dataRange.Text_Max = "高"; //chartMap.dataRange.Text = "Auto"; //chartMap.dataRange.Calculable = true; //#endregion //#region Toolbox工具栏设置 //chartMap.HaveToolBox = true; //chartMap.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //chartMap.Toolbox.Show = true; //chartMap.Toolbox.Orient = "vertical"; //chartMap.Toolbox.X = "right"; //chartMap.Toolbox.Y = "center"; //chartMap.Toolbox.Feature.Restore.Show = true; //chartMap.Toolbox.Feature.SaveAsImage.Show = true; //#endregion ////是否启用拖拽重计算特性 //chartMap.Calculable = true; //#region 设置地图缩放工具条 //chartMap.HaveRoamController = true; //chartMap.RoamController = new QMECRoamController() { MapTypeControl = new QMECMapTypeControl() }; //chartMap.RoamController.Show = true; //chartMap.RoamController.X = "right"; //chartMap.RoamController.MapTypeControl = new QMECMapTypeControl(); //chartMap.RoamController.MapTypeControl.China = true; //#endregion //#region 生成图表所需要数据格式 //QMECItemStyle itemStyle = new QMECItemStyle() { Normal = new QMECNormal() { Label = new QMECLabel() }, Emphasis = new QMECEmphasis() { Label = new QMECLabel()} }; //itemStyle.Normal.Label.Show = true; //itemStyle.Emphasis.Label.Show = true; //List dataSerie = new List(); //QMECSerie serie1 = new QMECSerie(); //serie1.Name = "iphone3"; //serie1.Type = "map"; //serie1.MapType = "china"; //serie1.Roam = false; //serie1.ItemStyle = itemStyle; //List data1 = new List(); //data1.Add("{name: '" + "北京" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "天津" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "上海" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "重庆" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "河北" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "河南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "云南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "辽宁" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "黑龙江" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "湖南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "安徽" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "山东" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "新疆" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "江苏" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "浙江" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "江西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "湖北" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "广西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "甘肃" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "山西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "内蒙古" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "陕西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "吉林" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "福建" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "贵州" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "广东" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "青海" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "西藏" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "四川" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "宁夏" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "海南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "台湾" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "香港" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //data1.Add("{name: '" + "澳门" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); //serie1.Data = data1.ToArray(); //dataSerie.Add(serie1); //QMECSerie serie2 = new QMECSerie(); //serie2.Name = "iphone4"; //serie2.Type = "map"; //serie2.MapType = "china"; //serie2.ItemStyle = itemStyle; //List data2 = new List(); //data2.Add("{name: '" + "北京" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "天津" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "上海" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "重庆" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "河北" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "安徽" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "新疆" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "浙江" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "江西" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "山西" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "内蒙古" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "吉林" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "福建" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "广东" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "西藏" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "四川" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "宁夏" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "香港" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data2.Add("{name: '" + "澳门" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //serie2.Data = data2.ToArray(); //dataSerie.Add(serie2); //QMECSerie serie3 = new QMECSerie(); //serie3.Name = "iphone5"; //serie3.Type = "map"; //serie3.MapType = "china"; //serie3.ItemStyle = itemStyle; //List data3 = new List(); //data3.Add("{name: '" + "北京" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data3.Add("{name: '" + "天津" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data3.Add("{name: '" + "上海" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data3.Add("{name: '" + "台湾" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //data3.Add("{name: '" + "香港" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); //serie3.Data = data3.ToArray(); //dataSerie.Add(serie3); //chartMap.Series = dataSerie; //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(chartMap)); #endregion } #endregion #region 扩展地图 /// /// 扩展地图 /// /// 处理结果 [HandleException] public ActionResult MapExt5() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 扩展地图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataMapExt5() { QMEChartMap chartMap = new QMEChartMap() { MapType = "mapExt5" }; chartMap.Title = new QMECTitle(); chartMap.Title.Text = "iphone销量"; chartMap.Title.Subtext = "纯属虚构"; chartMap.Title.X = "center";//对齐方式 chartMap.Tooltip = new QMECTooltip(); chartMap.Tooltip.Trigger = "item"; chartMap.Legend = new QMECLegend() { Data = new List() }; chartMap.Legend.Orient = "vertical"; chartMap.Legend.X = "left"; chartMap.Legend.Data.Add("iphone3"); chartMap.Legend.Data.Add("iphone4"); chartMap.Legend.Data.Add("iphone5"); chartMap.dataRange = new QMECDataRange(); chartMap.dataRange.Min = 0; chartMap.dataRange.Max = 2500; chartMap.dataRange.X = "left"; chartMap.dataRange.Y = "bottom"; chartMap.dataRange.Text_Min = "低"; chartMap.dataRange.Text_Max = "高"; chartMap.dataRange.Text = "Auto"; chartMap.dataRange.Calculable = true; chartMap.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; chartMap.Toolbox.Show = true; chartMap.Toolbox.Orient = "vertical"; chartMap.Toolbox.X = "right"; chartMap.Toolbox.Y = "center"; chartMap.Toolbox.Feature.Restore.Show = true; chartMap.Toolbox.Feature.SaveAsImage.Show = true; chartMap.Calculable = true; chartMap.RoamController = new QMECRoamController() { MapTypeControl = new QMECMapTypeControl() }; chartMap.RoamController.Show = true; chartMap.RoamController.X = "right"; chartMap.RoamController.MapTypeControl = new QMECMapTypeControl(); chartMap.RoamController.MapTypeControl.China = true; QMECItemStyle itemStyle = new QMECItemStyle() { Normal = new QMECNormal() { Label = new QMECLabel() }, Emphasis = new QMECEmphasis() { Label = new QMECLabel()} }; itemStyle.Normal.Label.Show = true; itemStyle.Emphasis.Label.Show = true; List dataSerie = new List(); QMECSerie serie1 = new QMECSerie(); serie1.Name = "iphone3"; serie1.Type = "map"; serie1.MapType = "china"; serie1.Roam = false; serie1.ItemStyle = itemStyle; List data1 = new List(); data1.Add("{name: '" + "北京" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "天津" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "上海" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "重庆" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "河北" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "河南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "云南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "辽宁" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "黑龙江" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "湖南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "安徽" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "山东" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "新疆" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "江苏" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "浙江" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "江西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "湖北" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "广西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "甘肃" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "山西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "内蒙古" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "陕西" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "吉林" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "福建" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "贵州" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "广东" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "青海" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "西藏" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "四川" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "宁夏" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "海南" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "台湾" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "香港" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); data1.Add("{name: '" + "澳门" + "',value:" + Math.Round(new Random().NextDouble() * 1000) + "}"); serie1.Data = data1.ToArray(); dataSerie.Add(serie1); QMECSerie serie2 = new QMECSerie(); serie2.Name = "iphone4"; serie2.Type = "map"; serie2.MapType = "china"; serie2.ItemStyle = itemStyle; List data2 = new List(); data2.Add("{name: '" + "北京" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "天津" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "上海" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "重庆" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "河北" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "安徽" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "新疆" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "浙江" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "江西" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "山西" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "内蒙古" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "吉林" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "福建" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "广东" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "西藏" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "四川" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "宁夏" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "香港" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data2.Add("{name: '" + "澳门" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); serie2.Data = data2.ToArray(); dataSerie.Add(serie2); QMECSerie serie3 = new QMECSerie(); serie3.Name = "iphone5"; serie3.Type = "map"; serie3.MapType = "china"; serie3.ItemStyle = itemStyle; List data3 = new List(); data3.Add("{name: '" + "北京" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data3.Add("{name: '" + "天津" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data3.Add("{name: '" + "上海" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data3.Add("{name: '" + "台湾" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); data3.Add("{name: '" + "香港" + "',value: " + Math.Round(new Random().NextDouble() * 1000) + "}"); serie3.Data = data3.ToArray(); dataSerie.Add(serie3); chartMap.Series = dataSerie; return Content(QMEChartHelper.QMECHelper(chartMap)); } #endregion #region 标准雷达图 /// /// 标准雷达图 /// /// 处理结果 [HandleException] public ActionResult Radar1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准雷达图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataRadar1() { #region 自定义创建图表 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Name = "预算分配(Allocated Budget)", TypeValue = "销售(sales)", Value = "4300" }); dataList.Add(new TestEChartModel() { Name = "预算分配(Allocated Budget)", TypeValue = "管理(Administration)", Value = "10000" }); dataList.Add(new TestEChartModel() { Name = "预算分配(Allocated Budget)", TypeValue = "信息技术(Information Techology)", Value = "28000" }); dataList.Add(new TestEChartModel() { Name = "预算分配(Allocated Budget)", TypeValue = "客服(Customer Support)", Value = "35000" }); dataList.Add(new TestEChartModel() { Name = "预算分配(Allocated Budget)", TypeValue = "研发(Development)", Value = "50000" }); dataList.Add(new TestEChartModel() { Name = "预算分配(Allocated Budget)", TypeValue = "市场(Marketing)", Value = "19000" }); dataList.Add(new TestEChartModel() { Name = "实际开销(Actual Spending)", TypeValue = "销售(sales)", Value = "5000" }); dataList.Add(new TestEChartModel() { Name = "实际开销(Actual Spending)", TypeValue = "管理(Administration)", Value = "14000" }); dataList.Add(new TestEChartModel() { Name = "实际开销(Actual Spending)", TypeValue = "信息技术(Information Techology)", Value = "28000" }); dataList.Add(new TestEChartModel() { Name = "实际开销(Actual Spending)", TypeValue = "客服(Customer Support)", Value = "31000" }); dataList.Add(new TestEChartModel() { Name = "实际开销(Actual Spending)", TypeValue = "研发(Development)", Value = "42000" }); dataList.Add(new TestEChartModel() { Name = "实际开销(Actual Spending)", TypeValue = "市场(Marketing)", Value = "21000" }); #endregion #region 默认设置 QMEChartRadar radarChart = new QMEChartRadar() { RadarType = "radar1" }; radarChart.DataList = dataList; #region 设置标题 radarChart.Title = new QMECTitle(); radarChart.Title.Text = "预算 vs 开销(Budget vs spending)"; radarChart.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 radarChart.HaveTooltip = true; #endregion #region Toolbox工具栏设置 radarChart.HaveToolBox = true; #endregion radarChart.Calculable = true; #region Legend图例设置 radarChart.HaveLegend = true; //统计类别 radarChart.LegendField = "Name"; #endregion #region XAxis横坐标轴设置 //子类型 radarChart.XAxisField = "TypeValue"; #endregion #region 生成图表所需要数据格式 //值 radarChart.ValueField = "Value"; radarChart.RadarData = QMEChartHelper.CovertDataToRadarData(radarChart); #endregion return Content(QMEChartHelper.QMECHelper(radarChart)); #endregion #region 自定义创建图表 //QMEChartRadar radarChart = new QMEChartRadar() { RadarType = "radar1" }; //#region 设置标题 //radarChart.Title = new QMECTitle(); //radarChart.Title.Text = "预算 vs 开销(Budget vs spending)"; //radarChart.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //radarChart.HaveTooltip = true; //radarChart.Tooltip = new QMECTooltip(); //radarChart.Tooltip.Trigger = "axis"; //#endregion //#region Legend图例设置 //radarChart.HaveLegend = true; //radarChart.Legend = new QMECLegend() { Data = new List() }; //radarChart.Legend.Orient = "vertical"; //radarChart.Legend.X = "right"; //radarChart.Legend.Y = "bottom"; //radarChart.Legend.Data.Add("预算分配(Allocated Budget)"); //radarChart.Legend.Data.Add("实际开销(Actual Spending)"); //#endregion //#region Toolbox工具栏设置 //radarChart.HaveToolBox = true; //radarChart.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //radarChart.Toolbox.Show = true; //radarChart.Toolbox.Feature.Mark.Show = true; //radarChart.Toolbox.Feature.Restore.Show = true; //radarChart.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //radarChart.Calculable = true; //#region 生成图表所需要数据格式 //List polarList = new List(); //List indicatorList = new List(); //indicatorList.Add(new QMECIndicator() { Text = "销售(sales)", Max = 6000 }); //indicatorList.Add(new QMECIndicator() { Text = "管理(Administration)", Max = 16000 }); //indicatorList.Add(new QMECIndicator() { Text = "信息技术(Information Techology)", Max = 30000 }); //indicatorList.Add(new QMECIndicator() { Text = "客服(Customer Support)", Max = 38000 }); //indicatorList.Add(new QMECIndicator() { Text = "研发(Development)", Max = 52000 }); //indicatorList.Add(new QMECIndicator() { Text = "市场(Marketing)", Max = 25000 }); //polarList.Add(new QMECPolar() { Indicator = indicatorList }); //radarChart.Polar = polarList; //radarChart.Serie = new QMECSerie(); //radarChart.Serie.Name = "预算 vs 开销(Budget vs spending)"; //radarChart.Serie.Type = "radar"; //radarChart.Serie.RadarData = "Auto"; //List radarData = new List(); //radarData.Add(new QMECRadarData() { Name = "预算分配(Allocated Budget)", Value = new int[] { 4300, 10000, 28000, 35000, 50000, 19000 } }); //radarData.Add(new QMECRadarData() { Name = "实际开销(Actual Spending)", Value = new int[] { 5000, 14000, 28000, 31000, 42000, 21000 } }); //radarChart.RadarData = radarData; //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(radarChart)); #endregion } #endregion #region 标准仪表盘 /// /// 标准仪表盘 /// /// 处理结果 [HandleException] public ActionResult Gauge1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准仪表盘 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataGauge1() { #region 默认设置 QMEChartGauge gaugeChart = new QMEChartGauge() { GaugeType = "gauge1" }; #region 设置标题 gaugeChart.Title = new QMECTitle(); gaugeChart.Title.Text = "XXX完成率"; gaugeChart.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 gaugeChart.HaveTooltip = true; #endregion #region Toolbox工具栏设置 gaugeChart.HaveToolBox = true; #endregion #region 生成图表所需要数据格式 gaugeChart.Serie = new QMECSerie(); gaugeChart.Serie.Name = "业务指标"; gaugeChart.Serie.Type = "gauge"; gaugeChart.Serie.Detail = new QMECDetail() { Formatter = "{value}%" }; gaugeChart.Serie.GaugeData = "Auto"; List gaugeList = new List(); gaugeList.Add(new QMECGaugeData() { Value = "92", Name = "完成率" }); gaugeChart.GaugeData = gaugeList; #endregion return Content(QMEChartHelper.QMECHelper(gaugeChart)); #endregion #region 自定义创建图表 //QMEChartGauge gaugeChart = new QMEChartGauge() { GaugeType = "gauge1" }; //#region 设置标题 //gaugeChart.Title = new QMECTitle(); //gaugeChart.Title.Text = "XXX完成率"; //gaugeChart.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //gaugeChart.HaveTooltip = true; //gaugeChart.Tooltip = new QMECTooltip(); //gaugeChart.Tooltip.Formatter = "'{a}
{b} : {c}%'"; //#endregion //#region Toolbox工具栏设置 //gaugeChart.HaveToolBox = true; //gaugeChart.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //gaugeChart.Toolbox.Show = true; //gaugeChart.Toolbox.Feature.Mark.Show = true; //gaugeChart.Toolbox.Feature.Restore.Show = true; //gaugeChart.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region 生成图表所需要数据格式 //gaugeChart.Serie = new QMECSerie(); //gaugeChart.Serie.Name = "业务指标"; //gaugeChart.Serie.Type = "gauge"; //gaugeChart.Serie.Detail = new QMECDetail() { Formatter = "{value}%" }; //gaugeChart.Serie.GaugeData = "Auto"; //List gaugeList = new List(); //gaugeList.Add(new QMECGaugeData() { Value = "92", Name = "完成率" }); //gaugeChart.GaugeData = gaugeList; //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(gaugeChart)); #endregion } /// /// 获取仪表盘最新数据 /// /// [HandleException] public ActionResult GetNewGaugeData() { try { return Json(new { value = new Random().Next(0, 100) }); } catch (Exception ex) { throw ex; } } #endregion #region 标准散点图 /// /// 标准散点图 /// /// 处理结果 [HandleException] public ActionResult Scatter1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准散点图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataScatter1() { #region 数据源列表 //生成数据 List dataList = new List(); #region 女性数据 dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 161.2, PersonWeight = 51.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170, PersonWeight = 59 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 172.5, PersonWeight = 55.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 147.2, PersonWeight = 49.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 159.5, PersonWeight = 50.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 174, PersonWeight = 54.5 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 154.4, PersonWeight = 46.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 162.1, PersonWeight = 53.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 168.9, PersonWeight = 62.3 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 167.6, PersonWeight = 58.3 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 167.6, PersonWeight = 61 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 168.3, PersonWeight = 54.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 156, PersonWeight = 52.7 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 162, PersonWeight = 54.7 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 151.1, PersonWeight = 48.7 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 164, PersonWeight = 55.7 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170, PersonWeight = 69.4 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 163.2, PersonWeight = 59.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 161.4, PersonWeight = 63.4 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 159, PersonWeight = 48.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 161, PersonWeight = 53.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 171.8, PersonWeight = 56.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 166.8, PersonWeight = 56.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 167.5, PersonWeight = 59 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 159.1, PersonWeight = 47.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170.9, PersonWeight = 54.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 168.2, PersonWeight = 49.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 175, PersonWeight = 82.5 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 173, PersonWeight = 59.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 162, PersonWeight = 55 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170, PersonWeight = 73.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 163.8, PersonWeight = 58.5 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 165.1, PersonWeight = 56.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 160.7, PersonWeight = 69.1 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 180.3, PersonWeight = 60.7 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 160, PersonWeight = 74.3 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 166, PersonWeight = 53.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 164.5, PersonWeight = 52.3 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 161.2, PersonWeight = 54.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 162.5, PersonWeight = 58.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 154.5, PersonWeight = 49 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 169, PersonWeight = 58.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 162.8, PersonWeight = 57.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 151.1, PersonWeight = 73.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 178, PersonWeight = 70.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 172.7, PersonWeight = 105.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 159.5, PersonWeight = 49.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 166, PersonWeight = 69.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 172.9, PersonWeight = 62.5 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 175, PersonWeight = 73.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 166.8, PersonWeight = 57.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 179.9, PersonWeight = 67.3 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 176.5, PersonWeight = 83 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 160.2, PersonWeight = 52.1 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 167.6, PersonWeight = 54.5 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 160, PersonWeight = 50.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 163.2, PersonWeight = 55.9 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 165.5, PersonWeight = 60 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 163, PersonWeight = 62 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 174, PersonWeight = 75.7 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 163.5, PersonWeight = 50 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 155, PersonWeight = 45.9 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170.3, PersonWeight = 64.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 159.8, PersonWeight = 50 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 166.2, PersonWeight = 58.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 159, PersonWeight = 55.6 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 168.2, PersonWeight = 53.4 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 164.3, PersonWeight = 59.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 163.5, PersonWeight = 51.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 157, PersonWeight = 63 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 176.2, PersonWeight = 66.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 153.4, PersonWeight = 42 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 157, PersonWeight = 47.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 176.5, PersonWeight = 87.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170.5, PersonWeight = 67.8 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 160, PersonWeight = 54.4 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 161.3, PersonWeight = 67.9 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 160, PersonWeight = 50.2 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 170, PersonWeight = 72.9 }); dataList.Add(new TestEChartModel() { Name = "女性", PersonHeight = 152.4, PersonWeight = 46.5 }); #endregion #region 男性数据 dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 174, PersonWeight = 65.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 181.5, PersonWeight = 74.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180, PersonWeight = 76.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184, PersonWeight = 79.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 176, PersonWeight = 78.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 178, PersonWeight = 89.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 183.5, PersonWeight = 74.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 170, PersonWeight = 59.5 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 186.7, PersonWeight = 87.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 182.9, PersonWeight = 88.7 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 169.5, PersonWeight = 75.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 163, PersonWeight = 57 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 177, PersonWeight = 71.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 167, PersonWeight = 64.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 171.2, PersonWeight = 79.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 174.5, PersonWeight = 63.9 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180.1, PersonWeight = 93 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 175.3, PersonWeight = 71.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184, PersonWeight = 86.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 177.8, PersonWeight = 83.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 192.7, PersonWeight = 93.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180.5, PersonWeight = 77.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180.3, PersonWeight = 82.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 175.5, PersonWeight = 70 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 182, PersonWeight = 67.2 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 171.4, PersonWeight = 84.7 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 188, PersonWeight = 84.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 174, PersonWeight = 86.2 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 171.5, PersonWeight = 61.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 186, PersonWeight = 84.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 177.8, PersonWeight = 74.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 181.6, PersonWeight = 78.9 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 177.5, PersonWeight = 72 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 175.5, PersonWeight = 80.9 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 193.5, PersonWeight = 80.7 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184.5, PersonWeight = 78.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 192, PersonWeight = 90 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 171.5, PersonWeight = 70 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 172.7, PersonWeight = 66.2 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180.3, PersonWeight = 76.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 188, PersonWeight = 72.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 170, PersonWeight = 61.3 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 172.7, PersonWeight = 73.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 177.2, PersonWeight = 94.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 172.7, PersonWeight = 75.3 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184.2, PersonWeight = 76.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 167, PersonWeight = 68.2 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 164.5, PersonWeight = 70 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 167.4, PersonWeight = 67.7 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 170.5, PersonWeight = 56.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180.6, PersonWeight = 72.7 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 186.5, PersonWeight = 72.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 175, PersonWeight = 62 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 176, PersonWeight = 74.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 173, PersonWeight = 72.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 176, PersonWeight = 86.4 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 164.5, PersonWeight = 63.2 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 189.2, PersonWeight = 84.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 177.8, PersonWeight = 68.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 175.3, PersonWeight = 72.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 172.1, PersonWeight = 74.9 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 182.2, PersonWeight = 87.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 174, PersonWeight = 86.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 171.8, PersonWeight = 66.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 192, PersonWeight = 101.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 181.1, PersonWeight = 66 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 182.4, PersonWeight = 74.5 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184.4, PersonWeight = 68 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 187.2, PersonWeight = 78.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184, PersonWeight = 81.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 174, PersonWeight = 71 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 176, PersonWeight = 85.9 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 173.5, PersonWeight = 81.8 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 173, PersonWeight = 60.9 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 172.8, PersonWeight = 69.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 184.2, PersonWeight = 80.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 180.3, PersonWeight = 82.6 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 167, PersonWeight = 59.1 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 164.1, PersonWeight = 55.2 }); dataList.Add(new TestEChartModel() { Name = "男性", PersonHeight = 174, PersonWeight = 72.2 }); #endregion #endregion #region 默认设置 QMEChartScatter scatterChart = new QMEChartScatter() { ScatterType = "scatter1" }; scatterChart.DataList = dataList; #region 设置标题 scatterChart.Title = new QMECTitle(); scatterChart.Title.Text = "男性女性身高体重分布"; scatterChart.Title.Subtext = "抽样调查来自: Heinz 2003"; #endregion #region Tooltip提示窗口设置 scatterChart.HaveTooltip = true; #endregion #region Toolbox工具栏设置 scatterChart.HaveToolBox = true; #endregion #region Legend图例设置 scatterChart.HaveLegend = true; scatterChart.LegendField = "Name"; #endregion #region XAxis横坐标轴设置 scatterChart.HaveXAxis = true; #endregion #region YAxis纵坐标轴设置 scatterChart.HaveYAxis = true; #endregion #region 设置数据横纵坐标对应字段 scatterChart.XAxisField = "PersonHeight"; scatterChart.YAxisField = "PersonWeight"; #endregion #region 生成图表所需要数据格式 scatterChart.Series = QMEChartHelper.CovertDataToScatterData(scatterChart); #endregion #region 设置辅助线 QMECMarkPoint mp = new QMECMarkPoint() { Data = new List() }; mp.Data.Add(new QMECPoint() { Type = "max", Name = "最大值" }); mp.Data.Add(new QMECPoint() { Type = "min", Name = "最小值" }); QMECMarkLine ml = new QMECMarkLine() { Data = new List() }; ml.Data.Add(new QMECPoint() { Type = "average", Name = "平均值" }); foreach (QMECSerie ser in scatterChart.Series) { ser.MarkLine = ml; ser.MarkPoint = mp; } #endregion return Content(QMEChartHelper.QMECHelper(scatterChart)); #endregion #region 生成图表所需要数据格式 //QMEChartScatter scatterChart = new QMEChartScatter() { ScatterType = "scatter1" }; //#region 设置标题 //scatterChart.Title = new QMECTitle(); //scatterChart.Title.Text = "男性女性身高体重分布"; //scatterChart.Title.Subtext = "抽样调查来自: Heinz 2003"; //#endregion //#region Tooltip提示窗口设置 //scatterChart.HaveTooltip = true; //scatterChart.Tooltip = new QMECTooltip() { AxisPointer = new QMECAxisPointer() { LineStyle = new QMECLineStyle() } }; //scatterChart.Tooltip.Trigger = "axis"; //scatterChart.Tooltip.ShowDelay = 0; //scatterChart.Tooltip.Formatter = "function (params) {if (params.value.length > 1) {return params.seriesName + ' :
'+ params.value[0] + 'cm ' + params.value[1] + 'kg ';}else {return params.seriesName + ' :
' + params.name + ' : ' + params.value + 'kg ';}}"; //scatterChart.Tooltip.AxisPointer.Show = true; //scatterChart.Tooltip.AxisPointer.Type = "cross"; //scatterChart.Tooltip.AxisPointer.LineStyle.Type = "dashed"; //scatterChart.Tooltip.AxisPointer.LineStyle.Width = 1; //#endregion //#region Legend图例设置 //scatterChart.HaveLegend = true; //scatterChart.Legend = new QMECLegend() { Data = new List() }; //scatterChart.Legend.Data.Add("女性"); //scatterChart.Legend.Data.Add("男性"); //#endregion //#region Toolbox工具栏设置 //scatterChart.HaveToolBox = true; //scatterChart.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), DataZoom = new QMECDataZoom(), Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //scatterChart.Toolbox.Show = true; //scatterChart.Toolbox.Feature.Mark.Show = true; //scatterChart.Toolbox.Feature.DataZoom.Show = true; //scatterChart.Toolbox.Feature.Restore.Show = true; //scatterChart.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //scatterChart.HaveXAxis = true; //scatterChart.XAxis = new QMECXAxis() { AxisLabel = new QMECAxisLabel() }; //scatterChart.XAxis.Type = "value"; //scatterChart.XAxis.Scale = true; //scatterChart.XAxis.AxisLabel = new QMECAxisLabel(); //scatterChart.XAxis.AxisLabel.Formatter = "{value} cm"; //#endregion //#region YAxis纵坐标轴设置 //scatterChart.HaveYAxis = true; //scatterChart.YAxis = new QMECYAxis() { AxisLabel = new QMECAxisLabel() }; //scatterChart.YAxis.Type = "value"; //scatterChart.YAxis.Scale = true; //scatterChart.YAxis.AxisLabel = new QMECAxisLabel(); //scatterChart.YAxis.AxisLabel.Formatter = "{value} kg"; //#endregion //#region 设置辅助线 //QMECMarkPoint mp = new QMECMarkPoint() { Data = new List() }; //mp.Data.Add(new QMECPoint() { Type = "max", Name = "最大值" }); //mp.Data.Add(new QMECPoint() { Type = "min", Name = "最小值" }); //QMECMarkLine ml = new QMECMarkLine() { Data = new List() }; //ml.Data.Add(new QMECPoint() { Type = "average", Name = "平均值" }); //#endregion //#region 生成图表所需要数据格式 //List dataList1 = new List(); //#region 设置数据 //dataList1.Add(new double[] { 161.2, 51.6 }); //dataList1.Add(new double[] { 170, 59 }); //dataList1.Add(new double[] { 172.5, 55.2 }); //dataList1.Add(new double[] { 147.2, 49.8 }); //dataList1.Add(new double[] { 159.5, 50.6 }); //dataList1.Add(new double[] { 174, 54.5 }); //dataList1.Add(new double[] { 154.4, 46.2 }); //dataList1.Add(new double[] { 162.1, 53.6 }); //dataList1.Add(new double[] { 168.9, 62.3 }); //dataList1.Add(new double[] { 167.6, 58.3 }); //dataList1.Add(new double[] { 167.6, 61 }); //dataList1.Add(new double[] { 168.3, 54.8 }); //dataList1.Add(new double[] { 156, 52.7 }); //dataList1.Add(new double[] { 162, 54.7 }); //dataList1.Add(new double[] { 151.1, 48.7 }); //dataList1.Add(new double[] { 164, 55.7 }); //dataList1.Add(new double[] { 170, 69.4 }); //dataList1.Add(new double[] { 163.2, 59.8 }); //dataList1.Add(new double[] { 161.4, 63.4 }); //dataList1.Add(new double[] { 159, 48.6 }); //dataList1.Add(new double[] { 161, 53.6 }); //dataList1.Add(new double[] { 171.8, 56.2 }); //dataList1.Add(new double[] { 166.8, 56.6 }); //dataList1.Add(new double[] { 167.5, 59 }); //dataList1.Add(new double[] { 159.1, 47.6 }); //dataList1.Add(new double[] { 170.9, 54.2 }); //dataList1.Add(new double[] { 168.2, 49.2 }); //dataList1.Add(new double[] { 175, 82.5 }); //dataList1.Add(new double[] { 173, 59.8 }); //dataList1.Add(new double[] { 162, 55 }); //dataList1.Add(new double[] { 170, 73.2 }); //dataList1.Add(new double[] { 163.8, 58.5 }); //dataList1.Add(new double[] { 165.1, 56.2 }); //dataList1.Add(new double[] { 160.7, 69.1 }); //dataList1.Add(new double[] { 180.3, 60.7 }); //dataList1.Add(new double[] { 160, 74.3 }); //dataList1.Add(new double[] { 166, 53.2 }); //dataList1.Add(new double[] { 164.5, 52.3 }); //dataList1.Add(new double[] { 161.2, 54.8 }); //dataList1.Add(new double[] { 162.5, 58.2 }); //dataList1.Add(new double[] { 154.5, 49 }); //dataList1.Add(new double[] { 169, 58.2 }); //dataList1.Add(new double[] { 162.8, 57.8 }); //dataList1.Add(new double[] { 151.1, 73.2 }); //dataList1.Add(new double[] { 178, 70.6 }); //dataList1.Add(new double[] { 172.7, 105.2 }); //dataList1.Add(new double[] { 159.5, 49.2 }); //dataList1.Add(new double[] { 166, 69.8 }); //dataList1.Add(new double[] { 172.9, 62.5 }); //dataList1.Add(new double[] { 175, 73.2 }); //dataList1.Add(new double[] { 166.8, 57.2 }); //dataList1.Add(new double[] { 179.9, 67.3 }); //dataList1.Add(new double[] { 176.5, 83 }); //dataList1.Add(new double[] { 160.2, 52.1 }); //dataList1.Add(new double[] { 167.6, 54.5 }); //dataList1.Add(new double[] { 160, 50.2 }); //dataList1.Add(new double[] { 163.2, 55.9 }); //dataList1.Add(new double[] { 165.5, 60 }); //dataList1.Add(new double[] { 163, 62 }); //dataList1.Add(new double[] { 174, 75.7 }); //dataList1.Add(new double[] { 163.5, 50 }); //dataList1.Add(new double[] { 155, 45.9 }); //dataList1.Add(new double[] { 170.3, 64.8 }); //dataList1.Add(new double[] { 159.8, 50 }); //dataList1.Add(new double[] { 166.2, 58.6 }); //dataList1.Add(new double[] { 159, 55.6 }); //dataList1.Add(new double[] { 168.2, 53.4 }); //dataList1.Add(new double[] { 164.3, 59.8 }); //dataList1.Add(new double[] { 163.5, 51.8 }); //dataList1.Add(new double[] { 157, 63 }); //dataList1.Add(new double[] { 176.2, 66.8 }); //dataList1.Add(new double[] { 153.4, 42 }); //dataList1.Add(new double[] { 157, 47.8 }); //dataList1.Add(new double[] { 176.5, 87.8 }); //dataList1.Add(new double[] { 170.5, 67.8 }); //dataList1.Add(new double[] { 160, 54.4 }); //dataList1.Add(new double[] { 161.3, 67.9 }); //dataList1.Add(new double[] { 160, 50.2 }); //dataList1.Add(new double[] { 170, 72.9 }); //dataList1.Add(new double[] { 152.4, 46.5 }); //#endregion //List dataList2 = new List(); //#region 设置数据 //dataList2.Add(new double[] { 174, 65.6 }); //dataList2.Add(new double[] { 181.5, 74.8 }); //dataList2.Add(new double[] { 180, 76.6 }); //dataList2.Add(new double[] { 184, 79.6 }); //dataList2.Add(new double[] { 176, 78.8 }); //dataList2.Add(new double[] { 178, 89.6 }); //dataList2.Add(new double[] { 183.5, 74.8 }); //dataList2.Add(new double[] { 170, 59.5 }); //dataList2.Add(new double[] { 186.7, 87.8 }); //dataList2.Add(new double[] { 182.9, 88.7 }); //dataList2.Add(new double[] { 169.5, 75.6 }); //dataList2.Add(new double[] { 163, 57 }); //dataList2.Add(new double[] { 177, 71.6 }); //dataList2.Add(new double[] { 167, 64.6 }); //dataList2.Add(new double[] { 171.2, 79.1 }); //dataList2.Add(new double[] { 174.5, 63.9 }); //dataList2.Add(new double[] { 180.1, 93 }); //dataList2.Add(new double[] { 175.3, 71.8 }); //dataList2.Add(new double[] { 184, 86.4 }); //dataList2.Add(new double[] { 177.8, 83.6 }); //dataList2.Add(new double[] { 192.7, 93.8 }); //dataList2.Add(new double[] { 180.5, 77.8 }); //dataList2.Add(new double[] { 180.3, 82.8 }); //dataList2.Add(new double[] { 175.5, 70 }); //dataList2.Add(new double[] { 182, 67.2 }); //dataList2.Add(new double[] { 171.4, 84.7 }); //dataList2.Add(new double[] { 188, 84.1 }); //dataList2.Add(new double[] { 174, 86.2 }); //dataList2.Add(new double[] { 171.5, 61.4 }); //dataList2.Add(new double[] { 186, 84.8 }); //dataList2.Add(new double[] { 177.8, 74.8 }); //dataList2.Add(new double[] { 181.6, 78.9 }); //dataList2.Add(new double[] { 177.5, 72 }); //dataList2.Add(new double[] { 175.5, 80.9 }); //dataList2.Add(new double[] { 193.5, 80.7 }); //dataList2.Add(new double[] { 184.5, 78.4 }); //dataList2.Add(new double[] { 192, 90 }); //dataList2.Add(new double[] { 171.5, 70 }); //dataList2.Add(new double[] { 172.7, 66.2 }); //dataList2.Add(new double[] { 180.3, 76.4 }); //dataList2.Add(new double[] { 188, 72.4 }); //dataList2.Add(new double[] { 170, 61.3 }); //dataList2.Add(new double[] { 172.7, 73.4 }); //dataList2.Add(new double[] { 177.2, 94.1 }); //dataList2.Add(new double[] { 172.7, 75.3 }); //dataList2.Add(new double[] { 184.2, 76.8 }); //dataList2.Add(new double[] { 167, 68.2 }); //dataList2.Add(new double[] { 164.5, 70 }); //dataList2.Add(new double[] { 167.4, 67.7 }); //dataList2.Add(new double[] { 170.5, 56.8 }); //dataList2.Add(new double[] { 180.6, 72.7 }); //dataList2.Add(new double[] { 186.5, 72.6 }); //dataList2.Add(new double[] { 175, 62 }); //dataList2.Add(new double[] { 176, 74.6 }); //dataList2.Add(new double[] { 173, 72.4 }); //dataList2.Add(new double[] { 176, 86.4 }); //dataList2.Add(new double[] { 164.5, 63.2 }); //dataList2.Add(new double[] { 189.2, 84.1 }); //dataList2.Add(new double[] { 177.8, 68.6 }); //dataList2.Add(new double[] { 175.3, 72.1 }); //dataList2.Add(new double[] { 172.1, 74.9 }); //dataList2.Add(new double[] { 182.2, 87.1 }); //dataList2.Add(new double[] { 174, 86.8 }); //dataList2.Add(new double[] { 171.8, 66.1 }); //dataList2.Add(new double[] { 192, 101.6 }); //dataList2.Add(new double[] { 181.1, 66 }); //dataList2.Add(new double[] { 182.4, 74.5 }); //dataList2.Add(new double[] { 184.4, 68 }); //dataList2.Add(new double[] { 187.2, 78.8 }); //dataList2.Add(new double[] { 184, 81.6 }); //dataList2.Add(new double[] { 174, 71 }); //dataList2.Add(new double[] { 176, 85.9 }); //dataList2.Add(new double[] { 173.5, 81.8 }); //dataList2.Add(new double[] { 173, 60.9 }); //dataList2.Add(new double[] { 172.8, 69.1 }); //dataList2.Add(new double[] { 184.2, 80.1 }); //dataList2.Add(new double[] { 180.3, 82.6 }); //dataList2.Add(new double[] { 167, 59.1 }); //dataList2.Add(new double[] { 164.1, 55.2 }); //dataList2.Add(new double[] { 174, 72.2 }); //#endregion //scatterChart.Series = new List(); //scatterChart.Series.Add(new QMECSerie() { Name = "女性", Type = "scatter", MarkLine = ml, MarkPoint = mp, DataListArr = dataList1 }); //scatterChart.Series.Add(new QMECSerie() { Name = "男性", Type = "scatter", MarkLine = ml, MarkPoint = mp, DataListArr = dataList2 }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(scatterChart)); #endregion } #endregion #region 标准气泡图 /// /// 标准气泡图 /// /// 处理结果 [HandleException] public ActionResult Scatter2() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准气泡图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataScatter2() { #region 数据源列表 //生成数据 List dataList = new List(); #region scatter1数据 dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 161.2, PersonWeight = 51.6, Diameter = 11 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170, PersonWeight = 59, Diameter = 18.5 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 172.5, PersonWeight = 55.2, Diameter = 12 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 147.2, PersonWeight = 49.8, Diameter = 15 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 159.5, PersonWeight = 50.6, Diameter = 18 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 174, PersonWeight = 54.5, Diameter = 17 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 154.4, PersonWeight = 46.2, Diameter = 20 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 162.1, PersonWeight = 53.6, Diameter = 22 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 168.9, PersonWeight = 62.3, Diameter = 23 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 167.6, PersonWeight = 58.3, Diameter = 24 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 167.6, PersonWeight = 61, Diameter = 25 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 168.3, PersonWeight = 54.8, Diameter = 26 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 156, PersonWeight = 52.7, Diameter = 24 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 162, PersonWeight = 54.7, Diameter = 27 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 151.1, PersonWeight = 48.7, Diameter = 28 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 164, PersonWeight = 55.7, Diameter = 29 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170, PersonWeight = 69.4, Diameter = 18.1 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 163.2, PersonWeight = 59.8, Diameter = 17.3 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 161.4, PersonWeight = 63.4, Diameter = 18 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 159, PersonWeight = 48.6, Diameter = 17.8 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 161, PersonWeight = 53.6, Diameter = 19.7 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 171.8, PersonWeight = 56.2, Diameter = 18.5 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 166.8, PersonWeight = 56.6, Diameter = 18.3 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 167.5, PersonWeight = 59, Diameter = 5.5 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 159.1, PersonWeight = 47.6, Diameter = 82}); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170.9, PersonWeight = 54.2, Diameter = 7 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 168.2, PersonWeight = 49.2, Diameter = 6 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 175, PersonWeight = 82.5, Diameter = 5 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 173, PersonWeight = 59.8, Diameter = 4 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 162, PersonWeight = 55, Diameter = 3 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170, PersonWeight = 73.2, Diameter = 2 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 163.8, PersonWeight = 58.5, Diameter = 1 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 165.1, PersonWeight = 56.2, Diameter = 8 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 160.7, PersonWeight = 69.1, Diameter = 9 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 180.3, PersonWeight = 60.7, Diameter = 10 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 160, PersonWeight = 74.3, Diameter = 11 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 166, PersonWeight = 53.2, Diameter = 12 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 164.5, PersonWeight = 52.3, Diameter = 13 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 161.2, PersonWeight = 54.8, Diameter = 15 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 162.5, PersonWeight = 58.2, Diameter = 14 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 154.5, PersonWeight = 49, Diameter = 16 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 169, PersonWeight = 58.2, Diameter = 18 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 162.8, PersonWeight = 57.8, Diameter = 17 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 151.1, PersonWeight = 73.2, Diameter = 19 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 178, PersonWeight = 70.6, Diameter = 20 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 172.7, PersonWeight = 105.2, Diameter = 21 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 159.5, PersonWeight = 49.2, Diameter = 22 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 166, PersonWeight = 69.8, Diameter = 23 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 172.9, PersonWeight = 62.5, Diameter = 24 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 175, PersonWeight = 73.2, Diameter = 25 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 166.8, PersonWeight = 57.2, Diameter = 26 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 179.9, PersonWeight = 67.3, Diameter = 27 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 176.5, PersonWeight = 83, Diameter = 28 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 160.2, PersonWeight = 52.1, Diameter = 29 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 167.6, PersonWeight = 54.5, Diameter = 30 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 160, PersonWeight = 50.2, Diameter = 31 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 163.2, PersonWeight = 55.9, Diameter = 32 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 165.5, PersonWeight = 60, Diameter = 33 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 163, PersonWeight = 62, Diameter = 34 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 174, PersonWeight = 75.7, Diameter = 33 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 163.5, PersonWeight = 50, Diameter = 32 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 155, PersonWeight = 45.9, Diameter = 32 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170.3, PersonWeight = 64.8, Diameter = 31 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 159.8, PersonWeight = 50, Diameter = 30 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 166.2, PersonWeight = 58.6, Diameter = 29 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 159, PersonWeight = 55.6, Diameter = 28 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 168.2, PersonWeight = 53.4, Diameter = 27 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 164.3, PersonWeight = 59.8, Diameter = 26 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 163.5, PersonWeight = 51.8, Diameter = 25 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 157, PersonWeight = 63, Diameter = 24 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 176.2, PersonWeight = 66.8, Diameter = 23 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 153.4, PersonWeight = 42, Diameter = 22 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 157, PersonWeight = 47.8, Diameter = 21 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 176.5, PersonWeight = 87.8, Diameter = 20 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170.5, PersonWeight = 67.8, Diameter = 19 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 160, PersonWeight = 54.4, Diameter = 18 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 161.3, PersonWeight = 67.9, Diameter = 17 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 160, PersonWeight = 50.2, Diameter = 16 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 170, PersonWeight = 72.9, Diameter = 15 }); dataList.Add(new TestEChartModel() { Name = "scatter1", PersonHeight = 152.4, PersonWeight = 46.5, Diameter = 14 }); #endregion #region scatter2数据 dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 174, PersonWeight = 65.6, Diameter = 1 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 181.5, PersonWeight = 74.8, Diameter = 2 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180, PersonWeight = 76.6, Diameter = 3 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184, PersonWeight = 79.6, Diameter = 4 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 176, PersonWeight = 78.8, Diameter = 5 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 178, PersonWeight = 89.6, Diameter = 6 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 183.5, PersonWeight = 74.8, Diameter = 7 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 170, PersonWeight = 59.5, Diameter = 8 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 186.7, PersonWeight = 87.8, Diameter = 9 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 182.9, PersonWeight = 88.7, Diameter = 10 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 169.5, PersonWeight = 75.6, Diameter = 11 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 163, PersonWeight = 57, Diameter = 12 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 177, PersonWeight = 71.6, Diameter = 13 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 167, PersonWeight = 64.6, Diameter = 14 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 171.2, PersonWeight = 79.1, Diameter = 15 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 174.5, PersonWeight = 63.9, Diameter = 16 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180.1, PersonWeight = 93, Diameter = 17 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 175.3, PersonWeight = 71.8, Diameter = 18 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184, PersonWeight = 86.4, Diameter = 19 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 177.8, PersonWeight = 83.6, Diameter = 20 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 192.7, PersonWeight = 93.8, Diameter = 21 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180.5, PersonWeight = 77.8, Diameter = 22 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180.3, PersonWeight = 82.8, Diameter = 23 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 175.5, PersonWeight = 70, Diameter = 24 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 182, PersonWeight = 67.2, Diameter = 25 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 171.4, PersonWeight = 84.7, Diameter = 26 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 188, PersonWeight = 84.1, Diameter = 27 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 174, PersonWeight = 86.2, Diameter = 28 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 171.5, PersonWeight = 61.4, Diameter = 29 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 186, PersonWeight = 84.8, Diameter = 30 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 177.8, PersonWeight = 74.8, Diameter = 31 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 181.6, PersonWeight = 78.9, Diameter = 32 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 177.5, PersonWeight = 72, Diameter = 33 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 175.5, PersonWeight = 80.9, Diameter = 34 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 193.5, PersonWeight = 80.7, Diameter = 35 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184.5, PersonWeight = 78.4, Diameter = 36 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 192, PersonWeight = 90, Diameter = 37 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 171.5, PersonWeight = 70, Diameter = 38 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 172.7, PersonWeight = 66.2, Diameter = 39 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180.3, PersonWeight = 76.4, Diameter = 40 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 188, PersonWeight = 72.4, Diameter = 1 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 170, PersonWeight = 61.3, Diameter = 2 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 172.7, PersonWeight = 73.4, Diameter = 3 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 177.2, PersonWeight = 94.1, Diameter = 4 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 172.7, PersonWeight = 75.3, Diameter = 5 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184.2, PersonWeight = 76.8, Diameter = 6 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 167, PersonWeight = 68.2, Diameter = 7 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 164.5, PersonWeight = 70, Diameter = 8 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 167.4, PersonWeight = 67.7, Diameter = 9 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 170.5, PersonWeight = 56.8, Diameter = 10 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180.6, PersonWeight = 72.7, Diameter = 11 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 186.5, PersonWeight = 72.6, Diameter = 12 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 175, PersonWeight = 62, Diameter = 13 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 176, PersonWeight = 74.6, Diameter = 14 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 173, PersonWeight = 72.4, Diameter = 15 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 176, PersonWeight = 86.4, Diameter = 16 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 164.5, PersonWeight = 63.2, Diameter = 17 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 189.2, PersonWeight = 84.1, Diameter = 18 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 177.8, PersonWeight = 68.6, Diameter = 19 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 175.3, PersonWeight = 72.1, Diameter = 20 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 172.1, PersonWeight = 74.9, Diameter = 21 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 182.2, PersonWeight = 87.1, Diameter = 22 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 174, PersonWeight = 86.8, Diameter = 23 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 171.8, PersonWeight = 66.1, Diameter = 24 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 192, PersonWeight = 101.6, Diameter = 25 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 181.1, PersonWeight = 66, Diameter = 26 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 182.4, PersonWeight = 74.5, Diameter = 27 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184.4, PersonWeight = 68, Diameter = 25 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 187.2, PersonWeight = 78.8, Diameter = 20 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184, PersonWeight = 81.6, Diameter = 10 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 174, PersonWeight = 71, Diameter = 9 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 176, PersonWeight = 85.9, Diameter = 8 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 173.5, PersonWeight = 81.8, Diameter = 7 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 173, PersonWeight = 60.9, Diameter = 6 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 172.8, PersonWeight = 69.1, Diameter = 5 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 184.2, PersonWeight = 80.1, Diameter = 4 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 180.3, PersonWeight = 82.6, Diameter = 3 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 167, PersonWeight = 59.1, Diameter = 5 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 164.1, PersonWeight = 55.2, Diameter = 4 }); dataList.Add(new TestEChartModel() { Name = "scatter2", PersonHeight = 174, PersonWeight = 72.2, Diameter = 1 }); #endregion #endregion #region 默认设置 QMEChartScatter scatterChart = new QMEChartScatter() { ScatterType = "scatter2" }; scatterChart.DataList = dataList; #region 设置标题 scatterChart.Title = new QMECTitle(); scatterChart.Title.Text = "scatter1与scatter2对比"; scatterChart.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 scatterChart.HaveTooltip = true; #endregion #region Legend图例设置 scatterChart.HaveLegend = true; scatterChart.LegendField = "Name"; #endregion #region Toolbox工具栏设置 scatterChart.HaveToolBox = true; #endregion #region XAxis横坐标轴设置 scatterChart.HaveXAxis = true; #endregion #region YAxis纵坐标轴设置 scatterChart.HaveYAxis = true; #endregion #region 设置数据横纵坐标对应字段 scatterChart.XAxisField = "PersonHeight"; scatterChart.YAxisField = "PersonWeight"; scatterChart.DiameterField = "Diameter"; #endregion #region 生成图表所需要数据格式 scatterChart.Series = QMEChartHelper.CovertDataToScatterData(scatterChart); #endregion return Content(QMEChartHelper.QMECHelper(scatterChart)); #endregion #region 自定义创建图表 //QMEChartScatter scatterChart = new QMEChartScatter() { ScatterType = "scatter2" }; //#region 设置标题 //scatterChart.Title = new QMECTitle(); //scatterChart.Title.Text = "scatter1与scatter2对比"; //scatterChart.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //scatterChart.HaveTooltip = true; //scatterChart.Tooltip = new QMECTooltip() { AxisPointer = new QMECAxisPointer() { LineStyle = new QMECLineStyle() } }; //scatterChart.Tooltip.Trigger = "axis"; //scatterChart.Tooltip.ShowDelay = 0; //scatterChart.Tooltip.AxisPointer = new QMECAxisPointer() { LineStyle = new QMECLineStyle() }; //scatterChart.Tooltip.AxisPointer.Show = true; //scatterChart.Tooltip.AxisPointer.Type = "cross"; //scatterChart.Tooltip.AxisPointer.LineStyle.Type = "dashed"; //scatterChart.Tooltip.AxisPointer.LineStyle.Width = 1; //#endregion //#region Legend图例设置 //scatterChart.HaveLegend = true; //scatterChart.Legend = new QMECLegend() { Data = new List() }; //scatterChart.Legend.Data.Add("scatter1"); //scatterChart.Legend.Data.Add("scatter2"); //#endregion //#region Toolbox工具栏设置 //scatterChart.HaveToolBox = true; //scatterChart.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), DataZoom = new QMECDataZoom(), Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //scatterChart.Toolbox.Show = true; //scatterChart.Toolbox.Feature.Mark.Show = true; //scatterChart.Toolbox.Feature.DataZoom.Show = true; //scatterChart.Toolbox.Feature.Restore.Show = true; //scatterChart.Toolbox.Feature.SaveAsImage.Show = true; //#endregion //#region XAxis横坐标轴设置 //scatterChart.HaveXAxis = true; //scatterChart.XAxis = new QMECXAxis(); //scatterChart.XAxis.Type = "value"; //scatterChart.XAxis.Scale = true; //scatterChart.XAxis.SplitNumber = 4; //#endregion //#region YAxis纵坐标轴设置 //scatterChart.HaveYAxis = true; //scatterChart.YAxis = new QMECYAxis(); //scatterChart.YAxis.Type = "value"; //scatterChart.YAxis.Scale = true; //scatterChart.YAxis.SplitNumber = 4; //#endregion //#region 生成图表所需要数据格式 ////string[] data1 = {"[100,200,300]","[150,250,350]","[400,500,600]","[450,550,650]","[700,800,900]","[750,850,950]"}; ////string[] data2 = {"[-100,-200,-300]", "[-150,-250,-350]", "[-400,-500,-600]", "[-450,-550,-650]", "[-700,-800,-900]", "[-750,-850,-950]" }; //List dataList1 = new List(); //#region 设置数据 //dataList1.Add(new double[] { 161.2, 51.6, 174 }); //dataList1.Add(new double[] { 170, 59, 181.5 }); //dataList1.Add(new double[] { 172.5, 55.2, 180 }); //dataList1.Add(new double[] { 147.2, 49.8, 184 }); //dataList1.Add(new double[] { 159.5, 50.6, 176 }); //dataList1.Add(new double[] { 174, 54.5, 178 }); //dataList1.Add(new double[] { 154.4, 46.2, 183.5 }); //dataList1.Add(new double[] { 162.1, 53.6, 170 }); //dataList1.Add(new double[] { 168.9, 62.3, 186.7 }); //dataList1.Add(new double[] { 167.6, 58.3, 182.9 }); //dataList1.Add(new double[] { 167.6, 61, 169.5 }); //dataList1.Add(new double[] { 168.3, 54.8, 163 }); //dataList1.Add(new double[] { 156, 52.7, 177 }); //dataList1.Add(new double[] { 162, 54.7, 167 }); //dataList1.Add(new double[] { 151.1, 48.7, 171.2 }); //dataList1.Add(new double[] { 164, 55.7, 174.5 }); //dataList1.Add(new double[] { 170, 69.4, 180.1 }); //dataList1.Add(new double[] { 163.2, 59.8, 175.3 }); //dataList1.Add(new double[] { 161.4, 63.4, 184 }); //dataList1.Add(new double[] { 159, 48.6, 177.8 }); //dataList1.Add(new double[] { 161, 53.6, 192.7 }); //dataList1.Add(new double[] { 171.8, 56.2, 180.5 }); //dataList1.Add(new double[] { 166.8, 56.6, 180.3 }); //dataList1.Add(new double[] { 167.5, 59, 175.5 }); //dataList1.Add(new double[] { 159.1, 47.6, 182 }); //dataList1.Add(new double[] { 170.9, 54.2, 171.4 }); //dataList1.Add(new double[] { 168.2, 49.2, 188 }); //dataList1.Add(new double[] { 175, 82.5, 174 }); //dataList1.Add(new double[] { 173, 59.8, 171.5 }); //dataList1.Add(new double[] { 162, 55, 186 }); //dataList1.Add(new double[] { 170, 73.2, 177.8 }); //dataList1.Add(new double[] { 163.8, 58.5, 181.6 }); //dataList1.Add(new double[] { 165.1, 56.2, 177.5 }); //dataList1.Add(new double[] { 160.7, 69.1, 175.5 }); //dataList1.Add(new double[] { 180.3, 60.7, 193.5 }); //dataList1.Add(new double[] { 160, 74.3, 184.5 }); //dataList1.Add(new double[] { 166, 53.2, 192 }); //dataList1.Add(new double[] { 164.5, 52.3, 171.5 }); //dataList1.Add(new double[] { 161.2, 54.8, 172.7 }); //dataList1.Add(new double[] { 162.5, 58.2, 180.3 }); //dataList1.Add(new double[] { 154.5, 49, 188 }); //dataList1.Add(new double[] { 169, 58.2, 170 }); //dataList1.Add(new double[] { 162.8, 57.8, 172.7 }); //dataList1.Add(new double[] { 151.1, 73.2, 177.2 }); //dataList1.Add(new double[] { 178, 70.6, 172.7 }); //dataList1.Add(new double[] { 172.7, 105.2, 184.2 }); //dataList1.Add(new double[] { 159.5, 49.2, 167 }); //dataList1.Add(new double[] { 166, 69.8, 164.5 }); //dataList1.Add(new double[] { 172.9, 62.5, 167.4 }); //dataList1.Add(new double[] { 175, 73.2, 170.5 }); //dataList1.Add(new double[] { 166.8, 57.2, 180.6 }); //dataList1.Add(new double[] { 179.9, 67.3, 186.5 }); //dataList1.Add(new double[] { 176.5, 83, 175 }); //dataList1.Add(new double[] { 160.2, 52.1, 176 }); //dataList1.Add(new double[] { 167.6, 54.5, 173 }); //dataList1.Add(new double[] { 160, 50.2, 176 }); //dataList1.Add(new double[] { 163.2, 55.9, 164.5 }); //dataList1.Add(new double[] { 165.5, 60, 189.2 }); //dataList1.Add(new double[] { 163, 62, 177.8 }); //dataList1.Add(new double[] { 174, 75.7, 175.3 }); //dataList1.Add(new double[] { 163.5, 50, 172.1 }); //dataList1.Add(new double[] { 155, 45.9, 182.2 }); //dataList1.Add(new double[] { 170.3, 64.8, 174 }); //dataList1.Add(new double[] { 159.8, 50, 171.8 }); //dataList1.Add(new double[] { 166.2, 58.6, 192 }); //dataList1.Add(new double[] { 159, 55.6, 181.1 }); //dataList1.Add(new double[] { 168.2, 53.4, 182.4 }); //dataList1.Add(new double[] { 164.3, 59.8, 184.4 }); //dataList1.Add(new double[] { 163.5, 51.8, 187.2 }); //dataList1.Add(new double[] { 157, 63, 184 }); //dataList1.Add(new double[] { 176.2, 66.8, 174 }); //dataList1.Add(new double[] { 153.4, 42, 176 }); //dataList1.Add(new double[] { 157, 47.8, 173.5 }); //dataList1.Add(new double[] { 176.5, 87.8, 173 }); //dataList1.Add(new double[] { 170.5, 67.8, 172.8 }); //dataList1.Add(new double[] { 160, 54.4, 184.2 }); //dataList1.Add(new double[] { 161.3, 67.9, 180.3 }); //dataList1.Add(new double[] { 160, 50.2, 167 }); //dataList1.Add(new double[] { 170, 72.9, 164.1 }); //dataList1.Add(new double[] { 152.4, 46.5, 174 }); //#endregion //List dataList2 = new List(); //#region 设置数据 //dataList2.Add(new double[] { 174, 65.6, 51.6 }); //dataList2.Add(new double[] { 181.5, 74.8, 59 }); //dataList2.Add(new double[] { 180, 76.6, 55.2 }); //dataList2.Add(new double[] { 184, 79.6, 49.8 }); //dataList2.Add(new double[] { 176, 78.8, 50.6 }); //dataList2.Add(new double[] { 178, 89.6, 54.5 }); //dataList2.Add(new double[] { 183.5, 74.8, 46.2 }); //dataList2.Add(new double[] { 170, 59.5, 53.6 }); //dataList2.Add(new double[] { 186.7, 87.8, 62.3 }); //dataList2.Add(new double[] { 182.9, 88.7, 58.3 }); //dataList2.Add(new double[] { 169.5, 75.6, 61 }); //dataList2.Add(new double[] { 163, 57, 54.8 }); //dataList2.Add(new double[] { 177, 71.6, 52.7 }); //dataList2.Add(new double[] { 167, 64.6, 54.7 }); //dataList2.Add(new double[] { 171.2, 79.1, 48.7 }); //dataList2.Add(new double[] { 174.5, 63.9, 55.7 }); //dataList2.Add(new double[] { 180.1, 93, 69.4 }); //dataList2.Add(new double[] { 175.3, 71.8, 59.8 }); //dataList2.Add(new double[] { 184, 86.4, 63.4 }); //dataList2.Add(new double[] { 177.8, 83.6, 48.6 }); //dataList2.Add(new double[] { 192.7, 93.8, 53.6 }); //dataList2.Add(new double[] { 180.5, 77.8, 56.2 }); //dataList2.Add(new double[] { 180.3, 82.8, 56.6 }); //dataList2.Add(new double[] { 175.5, 70, 59 }); //dataList2.Add(new double[] { 182, 67.2, 47.6 }); //dataList2.Add(new double[] { 171.4, 84.7, 54.2 }); //dataList2.Add(new double[] { 188, 84.1, 49.2 }); //dataList2.Add(new double[] { 174, 86.2, 82.5 }); //dataList2.Add(new double[] { 171.5, 61.4, 59.8 }); //dataList2.Add(new double[] { 186, 84.8, 55 }); //dataList2.Add(new double[] { 177.8, 74.8, 73.2 }); //dataList2.Add(new double[] { 181.6, 78.9, 58.5 }); //dataList2.Add(new double[] { 177.5, 72, 56.2 }); //dataList2.Add(new double[] { 175.5, 80.9, 69.1 }); //dataList2.Add(new double[] { 193.5, 80.7, 60.7 }); //dataList2.Add(new double[] { 184.5, 78.4, 74.3 }); //dataList2.Add(new double[] { 192, 90, 53.2 }); //dataList2.Add(new double[] { 171.5, 70, 52.3 }); //dataList2.Add(new double[] { 172.7, 66.2, 54.8 }); //dataList2.Add(new double[] { 180.3, 76.4, 58.2 }); //dataList2.Add(new double[] { 188, 72.4, 49 }); //dataList2.Add(new double[] { 170, 61.3, 58.2 }); //dataList2.Add(new double[] { 172.7, 73.4, 57.8 }); //dataList2.Add(new double[] { 177.2, 94.1, 73.2 }); //dataList2.Add(new double[] { 172.7, 75.3, 70.6 }); //dataList2.Add(new double[] { 184.2, 76.8, 105.2 }); //dataList2.Add(new double[] { 167, 68.2, 49.2 }); //dataList2.Add(new double[] { 164.5, 70, 69.8 }); //dataList2.Add(new double[] { 167.4, 67.7, 62.5 }); //dataList2.Add(new double[] { 170.5, 56.8, 73.2 }); //dataList2.Add(new double[] { 180.6, 72.7, 57.2 }); //dataList2.Add(new double[] { 186.5, 72.6, 67.3 }); //dataList2.Add(new double[] { 175, 62, 83 }); //dataList2.Add(new double[] { 176, 74.6, 52.1 }); //dataList2.Add(new double[] { 173, 72.4, 54.5 }); //dataList2.Add(new double[] { 176, 86.4, 50.2 }); //dataList2.Add(new double[] { 164.5, 63.2, 55.9 }); //dataList2.Add(new double[] { 189.2, 84.1, 60 }); //dataList2.Add(new double[] { 177.8, 68.6, 62 }); //dataList2.Add(new double[] { 175.3, 72.1, 75.7 }); //dataList2.Add(new double[] { 172.1, 74.9, 50 }); //dataList2.Add(new double[] { 182.2, 87.1, 45.9 }); //dataList2.Add(new double[] { 174, 86.8, 64.8 }); //dataList2.Add(new double[] { 171.8, 66.1, 50 }); //dataList2.Add(new double[] { 192, 101.6, 58.6 }); //dataList2.Add(new double[] { 181.1, 66, 55.6 }); //dataList2.Add(new double[] { 182.4, 74.5, 53.4 }); //dataList2.Add(new double[] { 184.4, 68, 59.8 }); //dataList2.Add(new double[] { 187.2, 78.8, 51.8 }); //dataList2.Add(new double[] { 184, 81.6, 63 }); //dataList2.Add(new double[] { 174, 71, 66.8 }); //dataList2.Add(new double[] { 176, 85.9, 42 }); //dataList2.Add(new double[] { 173.5, 81.8, 47.8 }); //dataList2.Add(new double[] { 173, 60.9, 87.8 }); //dataList2.Add(new double[] { 172.8, 69.1, 67.8 }); //dataList2.Add(new double[] { 184.2, 80.1, 54.4 }); //dataList2.Add(new double[] { 180.3, 82.6, 67.9 }); //dataList2.Add(new double[] { 167, 59.1, 50.2 }); //dataList2.Add(new double[] { 164.1, 55.2, 72.9 }); //dataList2.Add(new double[] { 174, 72.2, 46.5 }); //#endregion //scatterChart.Series = new List(); //scatterChart.Series.Add(new QMECSerie() { Name = "scatter1", Type = "scatter", SymbolSize = "function (value){return Math.round(value[2] / 5);}", DataListArr = dataList1 }); //scatterChart.Series.Add(new QMECSerie() { Name = "scatter2", Type = "scatter", SymbolSize = "function (value){return Math.round(value[2] / 5);}", DataListArr = dataList2 }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(scatterChart)); #endregion } #endregion #region 标准漏斗图 /// /// 标准漏斗图 /// /// 处理结果 [HandleException] public ActionResult Funnel1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 标准漏斗图 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataFunnel1() { #region 数据源列表 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Value = "60", TypeValue = "展现"}); dataList.Add(new TestEChartModel() { Value = "40", TypeValue = "点击"}); dataList.Add(new TestEChartModel() { Value = "20", TypeValue = "访问"}); dataList.Add(new TestEChartModel() { Value = "80", TypeValue = "咨询"}); dataList.Add(new TestEChartModel() { Value = "100", TypeValue = "订单"}); #endregion #region 默认设置 QMEChartFunnel funnelChart = new QMEChartFunnel() { FunnelType = "funnel1" }; //设置数据 funnelChart.DataList = dataList; #region 设置标题 funnelChart.Title = new QMECTitle(); funnelChart.Title.Text = "漏斗图"; funnelChart.Title.Subtext = "纯属虚构"; #endregion #region Tooltip提示窗口设置 funnelChart.HaveTooltip = true; #endregion #region Toolbox工具栏设置 funnelChart.HaveToolBox = true; #endregion #region Legend图例设置 funnelChart.HaveLegend = true; funnelChart.LegendField = "TypeValue"; #endregion //是否托拽后重新计算 funnelChart.Calculable = true; #region 生成图表所需要数据格式 //转换数据格式,值字段 funnelChart.ValueField = "Value"; List list = QMEChartHelper.CovertDataToFunnelData(funnelChart); funnelChart.Series = new List(); //生成漏斗图 funnelChart.Series.Add(new QMECSerie() { Name = "scatter1", Type = "funnel", Width = "40%", FunData = list }); //生成金字塔图,若无。 不赋值即可 QMECItemStyle itemStyle = new QMECItemStyle() { Normal = new QMECNormal() { Label = new QMECLabel() { Position = "left", Show = true }, LabelLine = new QMECLabelLine() { Show = true } } }; funnelChart.Series.Add(new QMECSerie() { Name = "scatter2", Type = "funnel", X = "50%", Sort = "ascending", ItemStyle = itemStyle, FunData = list }); #endregion return Content(QMEChartHelper.QMECHelper(funnelChart)); #endregion #region 自定义创建图表 //QMEChartFunnel funnelChart = new QMEChartFunnel() { FunnelType = "funnel1" }; //#region 设置标题 //funnelChart.Title = new QMECTitle(); //funnelChart.Title.Text = "漏斗图"; //funnelChart.Title.Subtext = "纯属虚构"; //#endregion //#region Tooltip提示窗口设置 //funnelChart.HaveTooltip = true; //funnelChart.Tooltip = new QMECTooltip(); //funnelChart.Tooltip.Trigger = "item"; //funnelChart.Tooltip.Formatter = "'{a}
{b} : {c} ({d}%)'"; //#endregion //#region Legend图例设置 //funnelChart.HaveLegend = true; //funnelChart.Legend = new QMECLegend() { Data = new List() }; //funnelChart.Legend.Data.Add("展现"); //funnelChart.Legend.Data.Add("点击"); //funnelChart.Legend.Data.Add("访问"); //funnelChart.Legend.Data.Add("咨询"); //funnelChart.Legend.Data.Add("订单"); //#endregion //#region Toolbox工具栏设置 //funnelChart.HaveToolBox = true; //funnelChart.Toolbox = new QMECToolbox() { Feature = new QMECFeature() { Mark = new QMECMark(), Restore = new QMECRestore(), SaveAsImage = new QMECSaveAsImage() } }; //funnelChart.Toolbox.Show = true; //funnelChart.Toolbox.Feature.Mark.Show = true; //funnelChart.Toolbox.Feature.Restore.Show = true; //funnelChart.Toolbox.Feature.SaveAsImage.Show = true; //funnelChart.Calculable = true; //#endregion //#region 生成图表所需要数据格式 //QMECItemStyle itemStyle = new QMECItemStyle() { Normal = new QMECNormal() { Label = new QMECLabel(), LabelLine = new QMECLabelLine() } }; //itemStyle.Normal.Label.Position = "left"; //itemStyle.Normal.Label.Show = true; //itemStyle.Normal.LabelLine.Show = true; //#endregion //List funData1 = new List(); //funData1.Add(new QMECFunnelData() { Value = "60", Name = "访问" }); //funData1.Add(new QMECFunnelData() { Value = "40", Name = "咨询" }); //funData1.Add(new QMECFunnelData() { Value = "20", Name = "订单" }); //funData1.Add(new QMECFunnelData() { Value = "80", Name = "点击" }); //funData1.Add(new QMECFunnelData() { Value = "100", Name = "展现" }); //funnelChart.Series = new List(); //funnelChart.Series.Add(new QMECSerie() { Name = "scatter1", Type = "funnel", Width = "40%", FunData = funData1 }); //List funData2 = new List(); //funData2.Add(new QMECFunnelData() { Value = "60", Name = "访问" }); //funData2.Add(new QMECFunnelData() { Value = "40", Name = "咨询" }); //funData2.Add(new QMECFunnelData() { Value = "20", Name = "订单" }); //funData2.Add(new QMECFunnelData() { Value = "80", Name = "点击" }); //funData2.Add(new QMECFunnelData() { Value = "100", Name = "展现" }); //funnelChart.Series.Add(new QMECSerie() { Name = "scatter2", Type = "funnel", X = "50%", Sort = "ascending", ItemStyle = itemStyle, FunData = funData2 }); //#endregion //return Content(QMAPP.Common.Web.QMEChart.QMEChartHelper.QMECHelper(funnelChart)); #endregion } #endregion #region 导出Line1 /// /// 导出Line1 /// /// 结果 [HttpPost] [HandleException] public ActionResult ExportLine1() { string imgSend = Request.Form["hiChartImg"]; imgSend = imgSend.Replace(" ", "+"); string[] contents = imgSend.Split(','); imgSend = contents[1]; byte[] content = Convert.FromBase64String(imgSend); System.Web.Mvc.FileContentResult result = null; result = new System.Web.Mvc.FileContentResult(content, "application/png"); result.FileDownloadName = System.Web.HttpUtility.UrlEncode("标准折线图.png", System.Text.Encoding.UTF8); return result; } #endregion #region 多图叠加 /// /// 多图叠加 /// /// 处理结果 [HandleException] public ActionResult Group1() { try { return View(); } catch (Exception ex) { throw ex; } } /// /// 多图叠加 /// /// 处理结果 [HandleException] public ActionResult GetEchartDataGroup1() { #region 源数据定义 string ad = @"{ tooltip: { trigger: 'axis' }, toolbox: { show: false, feature: { mark: { show: true }, dataView: { show: true, readOnly: false }, magicType: { show: true, type: ['line', 'bar'] }, restore: { show: true }, saveAsImage: { show: true } } }, calculable: true, legend: { data: ['开机时间', '加工时间', '利用率', '目标值'] }, xAxis: [ { type: 'category', data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] } ], yAxis: [ { type: 'value', name: '小时', axisLabel: { formatter: '{value} h' } }, { type: 'value', name: '百分比', axisLabel: { formatter: '{value} %' } } ], series: [ { name: '开机时间', type: 'bar', data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3] }, { name: '加工时间', type: 'bar', data: [2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3] }, { name: '利用率', type: 'line', yAxisIndex: 1, data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 18.8, 6.0, 2.3] ,itemStyle: { normal: { label: { show: true}} } }, { name: '目标值', type: 'line', yAxisIndex: 1, data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2] , itemStyle: { normal: { label: { show: true}} } } ] }"; #endregion return Content(ad); } /// /// 标准柱状图 /// /// 处理结果 [HandleException] public List GetBar1GroupData() { #region 源数据定义 //生成数据 List dataList = new List(); dataList.Add(new TestEChartModel() { Week = "一月", Value = "2.0", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "二月", Value = "4.9", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "三月", Value = "7.0", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "四月", Value = "23.2", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "五月", Value = "25.6", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "六月", Value = "2.7", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "七月", Value = "13.6", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "八月", Value = "16.2", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "九月", Value = "32.6", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "十月", Value = "20.0", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "十一月", Value = "6.4", TypeValue = "蒸发量" }); dataList.Add(new TestEChartModel() { Week = "十二月", Value = "3.3", TypeValue = "蒸发量" }); #endregion QMEChartBar chartLBar = new QMEChartBar() { BarType = "bar1" }; //设置源数据列表 chartLBar.DataList = dataList; #region 设置标题 //不为空时显示Title,为空时不显示 chartLBar.Title = new QMECTitle(); chartLBar.Title.Text = "蒸发量-降水量统计图"; chartLBar.Title.Subtext = "纯属虚构"; #endregion #region Legend图例设置 //是否有Legend chartLBar.HaveLegend = true; //Legend的自动统计字段,对应chartLine.DataList中用于统计的字段 chartLBar.LegendField = "TypeValue"; #endregion #region XAxis横坐标轴设置 //为空时使用默认值并从数据源中统计类型,需要设置DataList数据源 chartLBar.HaveXAxis = true; //设置X轴统计类型字段 chartLBar.XAxisField = "Week"; #endregion #region YAxis纵坐标轴设置 //设置Y轴显示格式。 chartLBar.HaveYAxis = true; //自定义设置 chartLBar.YAxis = new QMECYAxis() { AxisLabel = new QMECAxisLabel() }; chartLBar.YAxis.Type = "value"; #endregion #region 生成图表所需要数据格式 //转换数据格式,值字段 chartLBar.ValueField = "Value"; chartLBar.CateField = "Cate"; chartLBar.SubCateField = "SubCate"; chartLBar.Series = QMEChartHelper.CovertDataToSeries(chartLBar); #endregion return QMEChartHelper.CovertDataToSeries(chartLBar); } /// /// 统计图页面配置 /// /// public static string QMEChartPageConfig() { StringBuilder configBuilder = new StringBuilder(); configBuilder.AppendLine(""); configBuilder.AppendLine(""); configBuilder.AppendLine(""); configBuilder.AppendLine(""); return configBuilder.ToString(); } #endregion } }