ASP.NET关于使用chart.js绘制线形图的问题
<div>
<canvas id="can_LineChart" width="950" height="400" style="margin-top: 40px; margin-left: 20px;"></canvas>
</div><script>
$(function () {
$("#lbtSearch").click(function () {
var Device = $("#drp_Device").val();
var DeviceType = $("#drp_DeviceType").val();
var StartDate = $("input[name='inp_StartDate']").val()
var EndDate = $("input[name='inp_EndDate']").val()
$.post("../../Ajax/DeviceData_Chart.ashx?r=" + Math.random() + "&Device=" + Device + "&DeviceType=" + DeviceType + "&StartDate=" + StartDate + "&EndDate=" + EndDate + "",
function (data) {
var devicetype = new Array();
var addtime = new Array();
for (var i = 0; i < data.chart.length; i++) {
devicetype[i] = eval("data.chart[i]." + DeviceType.toUpperCase());
addtime[i] = data.chart[i].ADDTIME;
}
charts(devicetype, addtime);
}, "json");
});
});
function charts(devicetype, addtime) {
//alert(devicetype);
//alert(addtime);
var lineChartData = {
// x轴的标示
labels: addtime,
//labels: ["January", "February", "March", "April", "May", "June", "July"],
// 数据,数组中的每一个object代表一条线
datasets: [
{
// 颜色的使用类似于CSS,你也可以使用RGB、HEX或者HSL
// rgba颜色中最后一个值代表透明度
// 填充颜色
fillColor: "rgba(151,187,205,0)",
// 线的颜色
strokeColor: "rgba(151,187,205,1)",
// 点的填充颜色
pointColor: "rgba(151,187,205,1)",
// 点的边线颜色
pointStrokeColor: "#fff",
// 与x轴标示对应的数据
data: devicetype
},
]
}
var options = {
//Boolean - If we show the scale above the chart data
// 网格线是否在数据线的上面
scaleOverlay: false,
//Boolean - If we want to override with a hard coded scale
// 是否用硬编码重写y轴网格线
scaleOverride: false,
//** Required if scaleOverride is true **
//Number - The number of steps in a hard coded scale
// y轴刻度的个数
scaleSteps: null,
//Number - The value jump in the hard coded scale
// y轴每个刻度的宽度
scaleStepWidth: null,
//Number - The scale starting value
// y轴的起始值
scaleStartValue: null,
//String - Colour of the scale line
// x轴y轴的颜色
scaleLineColor: "rgba(0,0,0,1)",
//Number - Pixel width of the scale line
// x轴y轴的线宽
scaleLineWidth: 1,
//Boolean - Whether to show labels on the scale
// 是否显示y轴的标签
scaleShowLabels: true,
//String - Scale label font declaration for the scale label
// 标签的字体
scaleFontFamily: "'Arial'",
//Number - Scale label font size in pixels
// 标签字体的大小
scaleFontSize: 12,
//String - Scale label font weight style
// 标签字体的样式
scaleFontStyle: "normal",
//String - Scale label font colour
// 标签字体的颜色
scaleFontColor: "#666",
///Boolean - Whether grid lines are shown across the chart
// 是否显示网格线
scaleShowGridLines: true,
//String - Colour of the grid lines
// 网格线的颜色
scaleGridLineColor: "rgba(0,0,0,.1)",
//Number - Width of the grid lines
// 网格线的线宽
scaleGridLineWidth: 1,
//Boolean - Whether the line is curved between points
// 是否是曲线
bezierCurve: true,
//Boolean - Whether to show a dot for each point
// 是否显示点
pointDot: true,
//Number - Radius of each point dot in pixels
// 点的半径
pointDotRadius: 3,
//Number - Pixel width of point dot stroke
// 点的线宽
pointDotStrokeWidth: 1,
//Boolean - Whether to show a stroke for datasets
datasetStroke: true,
//Number - Pixel width of dataset stroke
// 数据线的线宽
datasetStrokeWidth: 3,
//Boolean - Whether to fill the dataset with a colour
// 数据线是否填充颜色
datasetFill: true,
//Boolean - Whether to animate the chart
// 是否有动画效果
animation: false,
//Number - Number of animation steps
// 动画的步数
animationSteps: 60,
//String - Animation easing effect
// 动画的效果
animationEasing: "easeOutQuart",
//Function - Fires when the animation is complete
// 动画完成后调用
onAnimationComplete: null
}
var myLine = new Chart(document.getElementById("can_LineChart").getContext("2d")).Line(lineChartData, options);
}
</script>相关推荐
asp.net中用web chart做各类统计图
一个完整的在asp.net中做Web chart的例子,包括第三方chart控件,以及完整的代码调用和使用. 绝对是好资源,C#,.NET,ASP.NET,Web,Web Chart,Chart
15款经典图表软件推荐
在这篇文章中,我将列出图表,图形和数据可视化的最佳软件,从创建基本的2D图表到产生复杂的数据集的数据可视化,这些PHP,Javascript、Flash的图表,对于任何一个严谨的开发者都是必须一览的。
应用Zedgraph高效开发数据图表
应用Zedgraph高效开发数据图表 可以对ZedGraph有很好的理解 论文中包括一些常用代码
C1WebChart
看到好多人都在找,我发上来吧
具有PWM控制VSC-HVDC链路的IEEE30总线传输系统(Simulink仿真实现)
内容概要:本文构建了一个包含PWM控制VSC-HVDC链路的IEEE30节点电力传输系统,并基于Simulink平台完成了系统的建模仿真。该模型聚焦于高压直流输电(HVDC)技术在区域电网互联中的应用,采用电压源型换流器(VSC)与脉宽调制(PWM)技术实现高效、灵活的电能传输。研究重点在于分析VSC-HVDC链路在复杂多节点电网中对潮流分布、系统稳定性及电能质量的调控能力,特别关注其在区域电网互联、新能源大规模接入以及跨区域电力交换等场景下的动态响应特性与控制性能,为现代智能电网的发展提供技术支撑与仿真验证手段。; 适合人群:具备电力系统、电气工程或自动化等相关专业背景的研究生、科研人员及工程技术人员。; 使用场景及目标:①用于研究VSC-HVDC在多节点电网(如IEEE30节点)中的建模与仿真方法;②分析PWM控制策略下HVDC链路对电网潮流分布、电压稳定性和故障穿越能力的影响;③为区域电网互联、新能源并网及智能电网调度等课题提供仿真基础和技术验证。; 阅读建议:此资源以Simulink仿真实现为核心,建议读者在掌握电力电子技术和电力系统分析基础知识的前提下,结合仿真模型深入理解VSC-HVDC的工作原理与控制策略。在学习过程中,应着重关注模型参数设置、控制环路设计及仿真结果的分析,以达到理论与实践相结合的目的。


图表区

