技术标签: date Javascript资料 string function ASP.NET html join xhtml
highcharts处理日期型X轴比较麻烦,用以下方法可以实现:
HTML:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Highcharts_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../JS/jquery-1.7.min.js" type="text/javascript"></script>
<script src="../JS/highcharts.js" type="text/javascript"></script>
</head>
<body>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto">
</div>
</body>
</html>
<script type="text/javascript">
$(function () {
var chart;
$(document).ready(function () {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'line',
marginRight: 130,
marginBottom: 25
},
title: {
text: '员工工资曲线图',
style:{
fontSize: '20px'
},
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
type: 'datetime',
labels: {
step: 4,
formatter: function () {
return Highcharts.dateFormat('%Y-%m-%d', this.value);
}
}
},
yAxis: {
title: {
text: '工资(¥)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br/>' +
Highcharts.dateFormat('%Y-%m-%d', this.x) + ': ¥' + this.y.toFixed(2);
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -10,
y: 100,
borderWidth: 0
},
plotOptions: {
series: {
cursor: 'pointer',
dataLabels: {
enabled: true,
formatter: function() {
return '¥' + this.y.toFixed(2);
}
},
point: {
events: {
click: function() {
alert ('Category: '+ Highcharts.dateFormat('%Y-%m-%d', this.x) +', value: '+ this.y + ",id:" + this.id);
}
}
}
}
},
series: [<%=dataPoints%> ]
});
});
});
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class Highcharts_Default : System.Web.UI.Page
{
public string dataPoints="";
protected void Page_Load(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dgmlOAConnectionString"].ConnectionString))
{
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "select max(money) as money,id, name,date from("
+ " SELECT sum(e.amount) as money,w.id, w.name,d.date,e.empCode"
+ " FROM ProductpSchedule_Tasks t"
+ " INNER JOIN ProductpSchedule_Main m ON t.pid = m.id"
+ " INNER JOIN ProductpSchedule_ReportData d ON t.id = d.pid"
+ " INNER JOIN workcenter w ON w.code = d.workcenterCode"
+ " INNER JOIN department dept ON w.pid = dept.id"
+ " Inner join dbo.ProductpSchedule_ReportData_Emps e on e.pid=d.id"
+ " WHERE d.date BETWEEN @date1 AND @date2 ";
cmd.CommandText += " group by w.id, w.name,d.date,e.empCode) t"
+ " group by id,name,date having(max(money))>0 order by id,date";
cmd.Parameters.Add("date1", "2012-4-1");
cmd.Parameters.Add("date2", "2012-9-1");
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
string ser = "";
string data = "";
TimeSpan ticks =new TimeSpan(new DateTime(1970, 1, 1).Ticks);
while (dr.Read())
{
if (ser != dr["name"].ToString())
{
if (ser != "")
{
if (dataPoints != "")
{
dataPoints += ",";
}
dataPoints += "{name:'" + ser + "',data:[" + data + "]}";
}
ser = dr["name"].ToString();
data = "{x:" + new TimeSpan(DateTime.Parse(dr["date"].ToString()).Ticks).Subtract(ticks).Duration().TotalMilliseconds.ToString() + ",y:" + dr["money"].ToString() + ",id:" + dr["id"].ToString() + "}";
}
else
{
if (data != "")
{
data += ",";
}
data += "{x:" + new TimeSpan(DateTime.Parse(dr["date"].ToString()).Ticks).Subtract(ticks).Duration().TotalMilliseconds.ToString() + ",y:" + dr["money"].ToString() + ",id:" + dr["id"].ToString() + "}";
}
}
if (dataPoints != "")
{
dataPoints += ",";
}
dataPoints += "{name:'" + ser + "',data:[" + data + "]}";
//Response.Write(dataPoints);
dr.Close();
cmd.Dispose();
}
}
}
package com.mpush.rsa;import java.io.ByteArrayInputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io...
http://forum.tuts4you.com/topic/17856-themidawinlicense-unpacking-questions/
先看一下对SourceGenerator的描述:Generates {@link com.bumptech.glide.load.data.DataFetcher DataFetchers} from original source datausing registered {@link com.bumptech.glide.load.model.ModelLoader ModelLoade...
为什么80%的码农都做不了架构师?>>> ...
读取图片文件将其转为二进制,再生成新的图片package com.image.test;/** * @title 读取图片文件将其转为二进制,再生成新的图片 * @author 让痛苦痛苦 * @缺点: 就是生成的新的图片颜色有点失真,....希望大家帮忙一起提提意见.本人邮件:[email protected] * */import java.awt.image.*;import j
1、基础环境 2、创建项目选择第三项自己配置按上下移动,空格键选择,回车键确定后面就按自己喜好去配,不懂可以摆渡3、安装cesium依赖4、配置vue.config.js在项目目录下新建vue.config.js,配置如下const CopyWebpackPlugin = require('copy-webpack-plugin')const webpack = require('webpack')const path = requi...
之前说起节流防抖,都是在事件内部用RXJS处理的(最开始写的是原生,设定计时器和开关)。后来看到别人把节流防抖放在 Angular 指令 Directives里,并且使用@output装饰器触发元素的指定事件。太妙了。...
已经卸载了hyper-v 仍然提示 vmware 与 hyper-v 不兼容;天天模拟器,提示VT模式没有开启,BIOS里面已经设置过了环境win10,vm的失败和模拟器的失败都是hyper-v冲突导致解决办法:卸载 hyper-v 后需要关闭hyper-v启动类型。具体步骤如下:以管理员身份运行命令提示符执行命令bcdedit /set hypervisorlaunchtype of...
如需转载请评论或简信,并注明出处,未经允许不得转载系列文章github地址目录期望结果:Recyclerview聚焦到最后一个Item,继续按下键,焦点保持不变。实际结果Recyclerview聚焦到最后一个Item,继续按下键,焦点会跳出RecyclerView,跳到附近的View上。问题一.gif问题分析那么当Recyclerview滑动到最底部时,按下键,Android系统是如何找到下一个需...
一、问题背景# pip list如果你执行了pip install --upgrade pip,你会发现pip坏了!# pip install zabbix-api二、解决方法如果安装了python2-pip,先卸载,再安装;如果没有安装,直接安装# yum -y remove python2-pip# yum -y install python2-pip# yum info python2-pip# pip instal...
前言前面再pyqt5多线程(QThread)遇到的坑(一)中提到了先实例化类,再把实例对象传参到线程类,这样的确时可行,但是还是遇到了新坑。https://blog.csdn.net/wuwei_201/article/details/104720386起因被实例化的类是做数据处理的,传入和导出的的数据比较大,最少都是几万行的excel表格数据(pandas.DataFrame),而且...
public class DateUtil {/** * All Dates are normalized to UTC, it is up the client code to convert to the appropriate TimeZone. */ public static final TimeZone UTC; /**