HighChart 体验之旅 (后台传递JSON参数和数据的方法)
转自:http://www.cnblogs.com/daviddai/archive/2013/04/12/Highchart.html
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> <%@ Import Namespace="DavidHighChartDemo.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
HighChart Demo Gallary
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>
HighChart Demo Gallary</h2>
<%=Html.Label("请选择图标:") %><%=Html.DropDownList("ddlChartType", new List<SelectListItem>() {
new SelectListItem() { Text = "混合型", Value=((int)HighchartTypeEnum.混合型).ToString(), Selected=true },
new SelectListItem() { Text = "饼图型", Value=((int)HighchartTypeEnum.饼图型).ToString() },
new SelectListItem() { Text = "柱状图", Value=((int)HighchartTypeEnum.柱状图).ToString() },
new SelectListItem() { Text = "多柱状图", Value=((int)HighchartTypeEnum.多柱状图).ToString() },
new SelectListItem() { Text = "多流线图", Value=((int)HighchartTypeEnum.多流线图).ToString() },
new SelectListItem() { Text = "多横柱图", Value=((int)HighchartTypeEnum.多横柱图).ToString() },
new SelectListItem() { Text = "层叠图", Value=((int)HighchartTypeEnum.层叠图).ToString() },
new SelectListItem() { Text = "区域图", Value=((int)HighchartTypeEnum.区域图).ToString() },
new SelectListItem() { Text = "温度计型", Value=((int)HighchartTypeEnum.温度计型).ToString() },
}, null, new { @onchange = "javascript:chartChangeEvent()" })%>
<div id="highChartContainer" class="mtop10">
<label id="highChartLabel"></label>
<div id="highChartDiv">
</div>
<span id="resultInfo" style="margin-left: 20px"></span>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
drawChart();
}) //初始化图标
var drawChart = function () {
$.ajax({
url: "/DavidTest/GetHighChartOptions",
type: "post",
data: { "type": $("#ddlChartType").find("option:selected").val() },
dataType: "json",
success: function (data) {
$("#highChartLabel").text(data.label);
draw(data.value);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
} //change事件
var chartChangeEvent = function () {
drawChart();
} //绘图方法
var draw = function (chartOptions) {
var chart = new Highcharts.Chart({
chart: chartOptions.chart,
title: chartOptions.title,
subtitle: chartOptions.subtitle,
credits: chartOptions.credits,
xAxis: chartOptions.xAxis,
yAxis: chartOptions.yAxis,
tooltip: chartOptions.tooltip,
plotOptions: {
pie: {
cursor: chartOptions.plotOptions.cursor
},
spline: {
stickyTracking: true
},
series: {
stacking: chartOptions.plotOptions.stacking,
point: {
events: {
mouseOver: function () {
$("#resultInfo").html("Category值:" + this.category + " X值:" + this.x + " Y值:" + this.y);
},
mouseOut: function () {
$("#resultInfo").empty();
}
}
},
marker: {
states: {
select: {
fillColor: "red",
lineWidth:
}
}
}
},
allowPointSelect: true
},
series: chartOptions.series,
exporting: chartOptions.exporting
});
}
</script>
</asp:Content>
前台
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading;
using DavidHighChartDemo.Models;
using DavidHighChartDemo.Logic; namespace DavidHighChartDemo.Controllers
{
public class DavidTestController : Controller
{
//
// GET: /DavidTest/ private DavidBusinessLogic logic = new DavidBusinessLogic(); public ActionResult HighCharts()
{
return View();
} public JsonResult GetHighChartOptions()
{
int chartType = Request.Form["type"] == null ? (int)HighchartTypeEnum.混合型 : Convert.ToInt32(Request.Form["type"].ToString());
HighchartTypeEnum type = (HighchartTypeEnum)Enum.Parse(typeof(HighchartTypeEnum), chartType.ToString());
HighChartOptions chart = logic.GetHighchart(type);
return Json(new { value = chart, label = type.ToString() }, JsonRequestBehavior.AllowGet);
}
}
}
Controller
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Drawing;
using DavidHighChartDemo.Models; namespace DavidHighChartDemo.Logic
{
public class DavidBusinessLogic
{
public HighChartOptions GetHighchart(HighchartTypeEnum type)
{
HighChartOptions currentChart = new HighChartOptions();
switch (type)
{
case HighchartTypeEnum.混合型:
{
#region 混合型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv",
type = ChartTypeEnum.area.ToString()
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false } },
series = new List<Series>() {
new Series(){
name = "网易",
data = new List<object>() {
new object[] { "中国", },
new object[] { "美国", },
new object[] { "英国", },
new { name = "韩国", y = , sliced = true, selected = true },
new object[] { "日本", }
},
type=ChartTypeEnum.pie.ToString(),
showInLegend=true,
size=,
center=new int[]{,},
allowPointSelect=true
},
new Series { name = "新浪", data = new List<object> { , , , , }, type= ChartTypeEnum.column.ToString(),allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, type=ChartTypeEnum.spline.ToString(), color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, type= ChartTypeEnum.spline.ToString(),allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.饼图型:
{
#region 饼图型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv",
type = ChartTypeEnum.pie.ToString()
},
title = new Title() { text = "地域流量图" },
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { pointFormat = "{series.name}: <b>{point.percentage}%</b><br/>{series.name}:{point.y}", percentageDecimals = },
series = new List<Series>() {
new Series(){
name="地域",
data = new List<object>() {
new object[] { "中国", },
new object[] { "美国", },
new object[] { "英国", },
new object[] { "韩国", },
new { name = "韩国", y = , sliced = true, selected = true },
new object[] { "日本", }
},
showInLegend=false,
size=,
center=new int[]{,},
allowPointSelect=true
}
}
}; #endregion
};
break;
case HighchartTypeEnum.柱状图:
{
#region 柱线图 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv"
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false } },
series = new List<Series>() {
new Series { name = "新浪", data = new List<object> { , , , , }, type= ChartTypeEnum.column.ToString(),allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, type=ChartTypeEnum.spline.ToString(), color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, type= ChartTypeEnum.spline.ToString(),allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.多柱状图:
{
#region 多柱型图 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv"
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false } },
series = new List<Series>() {
new Series { name = "新浪", data = new List<object> { , , , , }, type= ChartTypeEnum.column.ToString(),allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, type=ChartTypeEnum.column.ToString(), color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, type= ChartTypeEnum.column.ToString(),allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.多流线图:
{
#region 多流线型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv"
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false }, shared = true },
series = new List<Series>() {
new Series { name = "新浪", data = new List<object> { , , , , }, type= ChartTypeEnum.spline.ToString(),allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, type=ChartTypeEnum.spline.ToString(), color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, type= ChartTypeEnum.spline.ToString(),allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.多横柱图:
{
#region 多横柱型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv",
type = ChartTypeEnum.bar.ToString()
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false } },
series = new List<Series>() {
new Series { name = "新浪", data = new List<object> { , , , , }, allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.层叠图:
{
#region 层叠型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv",
type = ChartTypeEnum.column.ToString(),
style = "width:100%; heigh:400px;"
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false } },
plotOptions = new PlotOptions() { stacking = StackingTypeEnum.normal.ToString() },
series = new List<Series>() {
new Series { name = "新浪", data = new List<object> { , , , , }, allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.区域图:
{
#region 区域型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv",
type = ChartTypeEnum.areaspline.ToString()
},
title = new Title() { text = "网站流量图" },
xAxis = new List<XAxis>() {
new XAxis(){
categories = new List<string>() { "一月", "二月", "三月", "四月", "五月" },
reversed = false,
opposite = false
}
},
yAxis = new YAxis() { title = new Title() { text = "独立访问数" } },
tooltip = new ToolTip() { crosshairs = new List<bool>() { true, false } },
series = new List<Series>() {
new Series { name = "新浪", data = new List<object> { , , , , }, allowPointSelect=false, color="#CC6600" },
new Series { name = "腾讯", data = new List<object> { , , , , }, color="#33CCFF" },
new Series { name = "网易", data = new List<object> { , , , , }, allowPointSelect=false, color= "#0088A8" }
}
}; #endregion
};
break;
case HighchartTypeEnum.温度计型:
{
#region 温度计型 currentChart = new HighChartOptions()
{
chart = new Chart()
{
renderTo = "highChartDiv",
type = ChartTypeEnum.spline.ToString(),
inverted = true
},
title = new Title() { text = "Atmosphere Temperature by Altitude" },
subtitle = new SubTitle() { text = "According to the Standard Atmosphere Model" },
xAxis = new List<XAxis>(){
new XAxis(){reversed=false, title=new Title(){text="Altitude"}, categories=null}
},
yAxis = new YAxis() { title = new Title() { text = "Temperature" }, max = , min = - },
tooltip = new ToolTip() { headerFormat = "<b>{series.name}</b><br/>", pointFormat = "{point.x} km: {point.y}°C", percentageDecimals = },
series = new List<Series>() {
new Series(){
name="Temperature",
size=null,
showInLegend=false,
data = new List<object>() {
new object[] { , },
new object[] { , - },
new object[] { , -56.5 },
new object[] { , -46.5 },
new object[] { , -22.1 },
new object[] { , -2.5 },
new object[] { , -27.7 },
new object[] { , -55.7 },
new object[] { , -76.5 }
}
}
}
}; #endregion
};
break;
default:
break;
} return currentChart;
}
}
}
Service
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; namespace DavidHighChartDemo.Models
{
/// <summary>
/// HighChart图形类,其中所有基本属性都需要与官网API名字相同,否则可能引起JS错误
/// </summary>
public class HighChartOptions
{
public HighChartOptions()
{
this.chart = new Chart();
this.title = new Title();
this.subtitle = new SubTitle();
this.xAxis = new List<XAxis>();
this.yAxis = new YAxis();
this.series = new List<Series>();
this.tooltip = new ToolTip();
this.plotOptions = new PlotOptions();
this.credits = new Credits();
this.exporting = new Exporting();
} public Chart chart { get; set; } public Title title { get; set; } public SubTitle subtitle { get; set; } public List<XAxis> xAxis { get; set; } public YAxis yAxis { get; set; } public List<Series> series { get; set; } public ToolTip tooltip { get; set; } public PlotOptions plotOptions { get; set; } public Credits credits { get; set; } public Exporting exporting { get; set; }
} /// <summary>
/// 基础HighChart图形类
/// </summary>
public class Chart
{
public Chart()
{
this.renderTo = string.Empty;
this.type = string.Empty;
this.borderWidth = ;
this.borderColor = "#DDDDDD";
this.animation = new Animation();
this.ignoreHiddenSeries = false;
this.style = null;
this.className = null;
}
/// <summary>
/// 展示的dom元素区域,一般为ID
/// </summary>
public string renderTo { get; set; } /// <summary>
/// 设置或获取图表类型
/// </summary>
public string type { get; set; } /// <summary>
/// 设置或获取图表外部边框,默认为0,不显示边框
/// </summary>
public int borderWidth { get; set; } /// <summary>
/// 设置或获取外部边框颜色
/// </summary>
public string borderColor { get; set; } /// <summary>
/// 设置或获取图表背景色-默认颜色白底
/// </summary>
public string backgroundColor { get; set; } /// <summary>
/// 动画效果,若是想要关闭动画效果请将duration属性设置或获取为0
/// </summary>
public Animation animation { get; set; } /// <summary>
/// 设置或获取图表显示的render所用到的div上的css样式
/// </summary>
public string className { get; set; } /// <summary>
/// 设置或获取样式
/// </summary> public string style { get; set; } /// <summary>
/// 设置或获取图表高度
/// </summary>
public int? height { get; set; } /// <summary>
/// 设置或获取宽度
/// </summary>
public int? width { get; set; } /// <summary>
/// 设置隐藏Series指标轴是否动态变化
/// </summary>
public bool ignoreHiddenSeries { get; set; } /// <summary>
/// 设置X-Y坐标轴是否翻转
/// </summary>
public bool? inverted { get; set; } /// <summary>
/// 设置图表与div边框底部距离
/// </summary>
public int? marginBottom { get; set; } /// <summary>
/// 设置图表与div边框左边距离
/// </summary>
public int? marginLeft { get; set; } /// <summary>
/// 设置图表与div边框右边距离
/// </summary>
public int? marginRight { get; set; } /// <summary>
/// 设置图表与div边框顶部距离
/// </summary>
public int? marginTop { get; set; } /// <summary>
/// 是否自适应宽度高度
/// </summary>
public bool reflow { get; set; }
} public class Title
{
public Title()
{
this.text = string.Empty;
}
/// <summary>
/// 设置图表主标题
/// </summary>
public string text { get; set; }
} /// <summary>
/// 图表副标题
/// </summary>
public class SubTitle
{
public SubTitle()
{
this.text = string.Empty;
} public string text { get; set; }
} /// <summary>
/// 图形X轴
/// </summary>
public class XAxis
{
public XAxis()
{
this.categories = new List<string>();
this.plotLines = new List<PlotLines>();
this.opposite = false;
this.reversed = false;
this.title = new Title();
}
public Title title { get; set; } /// <summary>
/// 维度
/// </summary>
public List<string> categories { get; set; } /// <summary>
/// 趋势线(X轴,可以设置多条)
/// </summary>
public List<PlotLines> plotLines { get; set; } /// <summary>
/// 是否bar图形模式下的左右对称
/// </summary>
public bool opposite { get; set; } /// <summary>
/// 获取或者设置是否允许翻转
/// </summary>
public bool reversed { get; set; } /// <summary>
/// X轴中心线
/// </summary>
public int? linkedTo { get; set; }
} /// <summary>
/// Y轴
/// </summary>
public class YAxis
{
public YAxis()
{
this.title = new Title();
this.plotLines = new List<PlotLines>();
this.min = null;
this.max = null;
} public int? min { get; set; } public int? max { get; set; } public Title title { get; set; } public List<PlotLines> plotLines { get; set; }
} /// <summary>
/// 数据列
/// </summary>
public class Series
{
public Series()
{
this.name = string.Empty;
this.allowPointSelect = true;
this.size = ;
this.color = null;
this.showInLegend = true;
this.center = new int[] { , };
} public string type { get; set; } public string name { get; set; } public bool allowPointSelect { get; set; } public List<object> data { get; set; } public int[] center { get; set; } public int? size { get; set; } public string color { get; set; } public bool? showInLegend { get; set; } public int? pointInterval { get; set; }
} /// <summary>
/// 动画类
/// </summary>
public class Animation
{
public Animation()
{
this.duration = ;
} /// <summary>
/// 设置动画持续时间
/// </summary>
public int duration { get; set; } /// <summary>
/// 设置动画效果类似jquery效果中的easeOutBounce
/// </summary>
public string easing { get; set; }
} /// <summary>
/// Tooltip信息属性
/// </summary>
public class ToolTip
{
private string _pointFormat = string.Empty; public ToolTip()
{
this.backgroundColor = "#FFFFFF";
this.borderRadius = ;
this.borderWidth = ;
this.crosshairs = new List<bool>();
this.crosshairs.Add(false);
this.crosshairs.Add(false);
this.enabled = true;
this.shared = false;
this.useHTML = false;
this.headerFormat = "<small>{point.key}<small><br/>";
this.pointFormat = string.Empty;
this.footerFormat = string.Empty;
} /// <summary>
/// 设置或获取Tooltip提示背景默认淡黄色
/// </summary>
public string backgroundColor { get; set; } /// <summary>
/// 设置或获取Tooltip边框颜色
/// </summary>
public string borderColor { get; set; } /// <summary>
/// 设置或获取Tooltip边框圆角默认为5,为0时为矩形
/// </summary>
public int borderRadius { get; set; } /// <summary>
/// 设置或获取Tooltip边框宽度默认为2
/// </summary>
public int borderWidth { get; set; } /// <summary>
/// 设置或获取需不需要开启跟踪x,y跟踪条-第一个为x,第二个为y,注意只能输入2个参数
/// </summary>
public List<bool> crosshairs { get; set; } /// <summary>
/// 设置或获取是否启用tooltip /// </summary>
public bool enabled { get; set; } /// <summary>
/// 设置或获取多Series情况下是否共享自己的tooltip消息框
/// </summary>
public bool shared { get; set; } /// <summary>
/// 设置是否使用HTML模式来展示Tooltip框,默认使用SVG格式
/// </summary>
public bool useHTML { get; set; } /// <summary>
/// 设置支持以下几个HTML标签b, strong, i, e, b, span, br 标签头的值:{point.key}
/// </summary>
public string headerFormat { get; set; } /// <summary>
/// 设置数据点的格式,颜色:{series.color},名字:{series.name},值:{point.y}
/// </summary>
public string pointFormat
{
get
{
if (string.IsNullOrEmpty(this._pointFormat) && this.shared)
return "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b><br/>";
else if (string.IsNullOrEmpty(this._pointFormat) && !this.shared)
return "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.y}</b>";
else
return _pointFormat;
}
set
{
_pointFormat = value;
}
} /// <summary>
/// 设置数据底部格式,headerFormat,pointFormat,footerFormat三个加起来可以拼接成一个完成html
/// </summary>
public string footerFormat { get; set; } /// <summary>
/// 精确到小数点后的位数
/// </summary>
public int percentageDecimals { get; set; }
} /// <summary>
/// 版权信息属性
/// </summary>
public class Credits
{
public Credits()
{
this.enabled = false;
this.href = string.Empty;
this.text = string.Empty;
this.position = string.Empty;
} /// <summary>
/// 设置是否开启版权信息
/// </summary>
public bool enabled { get; set; } /// <summary>
/// 设置版权信息文本链接
/// </summary>
public string href { get; set; } /// <summary>
/// 设置或获取版权信息文本
/// </summary>
public string text { get; set; } /// <summary>
/// 设置版权信息文本
/// </summary>
public string position { get; set; }
} /// <summary>
/// 显示Legend标签
/// </summary>
public class Legend
{
public Legend()
{
this.align = "center";
this.verticalAlign = "bottom";
this.backgroundColor = string.Empty;
this.borderColor = "#909090";
this.borderRadius = ;
this.enabled = true;
this.floating = false;
this.layout = new LayoutTypeEnum();
this.navigation = new Navigation();
} public string align { get; set; } public string verticalAlign { get; set; } public string backgroundColor { get; set; } public string borderColor { get; set; } public int borderRadius { get; set; } public bool enabled { get; set; } public bool floating { get; set; } public LayoutTypeEnum layout { get; set; } public Navigation navigation { get; set; }
} /// <summary>
/// Legend标签是否需要导航条
/// </summary>
public class Navigation
{
public Navigation()
{
this.animation = false;
} public bool animation { get; set; }
} /// <summary>
///
/// </summary>
public class PlotLines
{
public PlotLines()
{
this.color = "#FFEE99";
this.dashStyle = "Solid";
this.width = ;
this.value = ;
} public string color { get; set; } public string dashStyle { get; set; } public double value { get; set; } public int width { get; set; }
} /// <summary>
/// 具体各个图形操作属性
/// </summary>
public class PlotOptions
{
public PlotOptions()
{
this.enableDataLabels = false;
this.enableMouseTracking = true;
this.stacking = null;
this.showInLegend = false;
this.cursor = "pointer";
} public bool enableDataLabels { get; set; } public bool enableMouseTracking { get; set; } public string stacking { get; set; } public bool showInLegend { get; set; } public string cursor { get; set; }
} public class Exporting
{
public Exporting()
{
this.exporting = true;
} public bool exporting { get; set; }
} /// <summary>
/// 图形类型枚举
/// </summary>
public enum ChartTypeEnum
{
bar = ,
line,
spline,
column,
pie,
scattar,
gauge,
area,
arearange,
areasplinerange,
areaspline
} /// <summary>
/// 布局显示枚举
/// </summary>
public enum LayoutTypeEnum
{
horizontal = ,
vertical
} public enum StackingTypeEnum
{
normal = ,
percent
}
}
最主要的HighChart实体封装类
HighChart 体验之旅 (后台传递JSON参数和数据的方法)的更多相关文章
- ajax向后台传递数组参数并将后台响应的数据赋值给一个变量供其它插件使用
1.在js中封装ajax向后台传递数组参数函数 //combogrid * * @Description 封装ajax向后台传递数组参数并将后台响应的数据赋值给一个变量方便其他插件使用该数据函数 * ...
- Ajax前台返回JSON数据后再Controller中直接转换成类型使用,后台接收json转成实体的方法
之前写过一篇记录文章,写的是将一个比较复杂的数据结构在前台组合起来后传递到后台. 当时并不太了解@RequestBody,也并没有使用js提供的JSON.stringify()方法 所有都是自己写的, ...
- JSON三种数据解析方法(转)
原 JSON三种数据解析方法 2018年01月15日 13:05:01 zhoujiang2012 阅读数:7896 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blo ...
- Ajax向前后台传递json和转换
学生管理系统MVC模式设计心得: jquery .ajax提交data数据格式 jquery 的Ajax方法提交数据,但是是多个参数,具体data的格式如下: data提交的数据类型为:Object ...
- Spring MVC(七)--传递JSON参数
有时候参数的传递还需要更多的参数,比如一个获取用户信息的请求中既有用户ID等基本参数,还要求对查询结果进行分页,针对这种场景,一般都会将分页参数封装成一个对象,然后将它和基本参数一起传给控制器,为了控 ...
- WebApi传递JSON参数
开发过程中经常进行JSON的传递,在WebApi中传递JSON字串时,会发现服务器端接收到不参数值,看下面代码 服务端: public void Post([FromBody]string value ...
- SpringBoot:自定义注解实现后台接收Json参数
0.需求 在实际的开发过程中,服务间调用一般使用Json传参的模式,SpringBoot项目无法使用@RequestParam接收Json传参 只有@RequestBody支持Json,但是每次为了一 ...
- c# HttpWebRequest 模拟HTTP post 传递JSON参数
//HTTP post JSON 参数 private string HttpPost(string Url, Object ticket) { ...
- curl 使用 post 请求,传递 json 参数,下载文件
curl -X POST http://ip:8888/nacos/v1/cs/file/download -H "Accept: application/octet-stream" ...
随机推荐
- 关于createTextRange和createRange的一些用法【转】
一.返回createTextRange的text和htmlText <mce:script language="javascript"><!--function ...
- Caliburn.Micro 资源随时添加
Caliburn.Micro – Hello World http://buksbaum.us/2010/08/01/caliburn-micro-hello-world/ http://blog.c ...
- WPF 卡顿调试经验
1. 问题 最近的一个项目,正常调试情况下,运行一切正常,但是有某个用户登录后,出现界面卡顿2-3mins后,才正常运行. 2.解决问题方法 (1)首先由于是必现问题,就想在vs的工作环境下调试一下, ...
- ClamAV学习【5】—— cli_scanpe函数浏览
这近2000行的代码,要是没有Source Insight,都不知道怎么看下去.跟着跟着来到了PE文件查杀的地方,发现前面都中规中矩地进行PE属性检查,中间一段开始扫描每个区块,然后和特征库的size ...
- 2018-2019-2 网络对抗技术 20165219 Exp3 免杀原理与实践
2018-2019-2 网络对抗技术 20165219 Exp3 免杀原理与实践 实验任务 1 正确使用msf编码器,msfvenom生成如jar之类的其他文件,veil-evasion,自己利用sh ...
- 【OCP题库】最新CUUG OCP 12c 071考试题库(65题)
65.(22-16) choose the best answer: The CUSTOMERS table has the following structure: You need to writ ...
- Python 的 GIL 是什么鬼,多线程性能究竟如何
作者:卢钧轶(cenalulu) 本文原文地址: http://cenalulu.github.io/python/gil-in-python/ 前言:博主在刚接触Python的时候时常听到GIL这个 ...
- Dota2App--第三天
一.要实现的功能 1.新特性页面 1.1.是否进入新特性界面的两种情况 1)第一次安装此APP,进入新特性界面 2)不是第一次安装,但是有版本更新,进入新特性界面 1.2.具体的代码实现 //0.版本 ...
- 基于Django+celery二次开发动态配置定时任务 ( 二)
一.需求 结合上一篇,使用djcelery模块开发定时任务时,定时任务的参数都保存在djcelery_periodictask表的args.kwargs字段里,并且是json格式.那么,当定时任务多了 ...
- 2017 最新的 cocoaPods 安装方法
经过努力终于发现了最新的 解决cocoaPods安装的办法: taobao Gems 源已停止维护,现由 ruby-china 提供镜像服务 第一步:安装rvm, 不管需不需要升级ruby,rvm可以 ...