在asp.net里一般用什么做分析的图(如:曲线图,饼图,柱状图),开发比较块,样式漂亮,对于曲线图最后能实现能显示几条曲线:
如:在一个坐标中显示:采购数量,采购金额,等曲线图项目赶的急马上要出东西来,没有时间研究,打家最后能贴出代码,或发代码到[email protected]最后不要给我发那些需要花钱买的第三方组件的例子,因为我们这个项目没有钱买啊.最想了解的是曲线图,分不够我可以补上.
如:在一个坐标中显示:采购数量,采购金额,等曲线图项目赶的急马上要出东西来,没有时间研究,打家最后能贴出代码,或发代码到[email protected]最后不要给我发那些需要花钱买的第三方组件的例子,因为我们这个项目没有钱买啊.最想了解的是曲线图,分不够我可以补上.
解决方案 »
- .NET MVC 如何设置某文件不受MVC路由控制?
- 读取数据
- .net 中调用vbs文件遇到的问题!!
- ASP.NET控件问题
- 编译好的asp.net文件,把bin目录移动之后,需要修改哪里才可以?
- 我在向数据库里插入超文本时报错,有潜在的危险.请问怎么去掉检测?谢谢
- 时间格式的转换
- 很奇怪的一个问题
- 关于Treeview:为什么我的父节点既响应链接又响应展开下一级节点,如何让它只响应展开操作?
- 我是新手,请问这个问题怎么办?编译自定义控件时vbc.exe显示无法找到 Imports“System.Web"”的命名空间或类型“Web”。
- 好苦恼啊,提示说“没有强名称”
- datagrid的绑定字段引用变量问题
如:在一个坐标中显示:采购数量,采购金额,等曲线图
-----------------------
我也打算用OWC11但大家发写例子啊
这里有原代码
需要的话,我给你发一个。好啊,你给我发个例子看看,[email protected]
Dim material_select = DropDownList1.SelectedValue
Dim series As New Series("line")
'series.ChartType = "spline"
series.BorderWidth = 4
Dim this_month, this_day, i, j
i = Split(System.DateTime.Today, "-")
Dim the_month = i(0) & "年" & i(1) & "月"
If Len(i(1)) = 1 Then
i(1) = "0" & i(1)
End If
If Len(i(2)) = 1 Then
i(2) = "0" & i(2)
End If
'this_day = i(0) & i(1) & i(2)
this_day = System.DateTime.Today.ToString("yyyyMMdd")
this_month = i(0) & i(1)
Dim month_first = i(0) & i(1) & "01"
sql = "select * from VIEW_PSD_JOIN_COUNT where samp_id >='" & month_first & "' and samp_id <='" & this_day & "' and stat_name = '" & material_select & "' order by samp_id"
da = New OracleDataAdapter(sql, cn)
Dim ds_material As DataSet = New DataSet
Try
da.Fill(ds_material, "material")
Catch ex As Exception
Response.Write("<script>alert('" + ex.message + "')</script>")
Return
End Try
cn.Close()
da.Dispose() Dim tabel1 As DataTable = ds_material.Tables("material")
Dim x As Integer = ds_material.Tables("material").Rows.Count Dim c As New DataColumn("prodece_plan")
c.DataType = System.Type.GetType("System.Decimal")
c.Caption = "prodece_plan"
tabel1.Columns.Add(c) Dim d As New DataColumn("sale_plan")
d.DataType = System.Type.GetType("System.Decimal")
d.Caption = "sale_plan"
tabel1.Columns.Add(d) Dim produce_left As New DataColumn("produce_left")
produce_left.DataType = System.Type.GetType("System.Decimal")
produce_left.Caption = "sale_plan"
tabel1.Columns.Add(produce_left) Dim y
For y = 0 To x - 1
Dim day_count = CInt(Right(tabel1.Rows(y)("samp_id"), 2))
tabel1.Rows(y).Item("prodece_plan") = Int(tabel1.Rows(y)("plan_produce") * day_count / month_day())
tabel1.Rows(y).Item("sale_plan") = Int(tabel1.Rows(y)("prodece_plan") * day_count / month_day())
'Dim the_samp_id = CDate(tabel1.Rows(y)("samp_id"))
Dim the_year = Left(tabel1.Rows(y)("samp_id"), 4)
Dim cur_month = CInt(Mid(tabel1.Rows(y)("samp_id"), 5, 2))
Dim samp_day = CDate(the_year & "-" & cur_month & "-" & day_count)
'Dim the_samp_id = CDate(samp_day)
Dim next_month_first
If cur_month = 12 Then
next_month_first = CDate((the_year + 1) & "-1-1")
Else
next_month_first = CDate(the_year & "-" & (cur_month + 1) & "-1")
End If
Dim month_lef = Math.Round(DateDiff(DateInterval.Day, samp_day, next_month_first) - 5 / 3, 3)
If tabel1.Rows(y)("plan_produce") > tabel1.Rows(y)("mount_produce") Then
tabel1.Rows(y)("produce_left") = Math.Round((tabel1.Rows(y)("plan_produce") - tabel1.Rows(y)("mount_produce")) / month_lef, 0)
End If
Next Dim dv As DataView = New DataView
'Chart1.Titles.Insert(0, "公司" & the_month & material_select & "生产情况走势")
dv = tabel1.DefaultView
Dim sername As String = the_month & material_select & "的" & Dropdownlist2.SelectedValue
If Chart1.Series.GetIndex(sername) > 0 Then
Label3.ForeColor = Color.Red
Label3.Text = "指定的项目已经存在"
Return
End If If Chart1.Series.Count > 3 Then
Label3.ForeColor = Color.Red
Label3.Text = "项目太多,请清除不需要的项目"
Return
End If
Try
Dim ser As Series = Chart1.Series.Add(sername)
ser.Color = sercolors(Chart1.Series.Count - 1)
ser.LegendText = the_month & material_select & "的" & Dropdownlist2.SelectedValue
ser.ChartArea = Chart1.ChartAreas(0).Name
ser.ChartType = "spline"
ser.XValueType = ChartValueTypes.Date
ser.ShowLabelAsValue = cbDigit.Checked
'ser.Name = sername.ToString
If Dropdownlist2.SelectedValue = "当日产量" Then
ser.Points.DataBindXY(dv, "samp_id", dv, "today_produce")
ser.FontColor = Color.Red
ElseIf Dropdownlist2.SelectedValue = "剩余日均" Then
ser.Points.DataBindXY(dv, "samp_id", dv, "produce_left")
ser.FontColor = Color.Blue
ElseIf Dropdownlist2.SelectedValue = "当日月累" Then
ser.Points.DataBindXY(dv, "samp_id", dv, "mount_produce")
'Chart1.Series.YAxisType = AxisType.Secondary
ser.YAxisType = AxisType.Secondary
ser.FontColor = Color.Black
ElseIf Dropdownlist2.SelectedValue = "计划进度" Then
ser.Points.DataBindXY(dv, "samp_id", dv, "prodece_plan")
ser.FontColor = Color.Chocolate
ser.YAxisType = AxisType.Secondary
End If
ser.ValueMemberX = "samp_id"
'Label3.ForeColor = Color.Blue
Label3.Text = ""
Catch ex As Exception
Label3.ForeColor = Color.Red
Label3.Text = ex.Message
End Try
微软本身就给我们提供了很好用的组件OWC(噢~~WC!;)http://dotnet.aspx.cc/ShowDetail.aspx?id=ADB6D011-A4AD-43A0-A8BF-3CED872A7A95在ASP.NET中使用Office Web Components (OWC)创建统计图
看了上面哪个统计图,你就会后悔用了其他的统计图
谢谢!
public void BuildLineWebChart(string pTitle,string pXValue,string pYValue,int pWidth,int pHeight,string[] arrValues,string[] arrValueNames,string pSavePath)
{
//创建ChartSpace对象来放置图表
OWC.ChartSpace objCSpace = new OWC.ChartSpaceClass (); //在ChartSpace对象中添加图表,Add方法返回chart对象
OWC.WCChart objChart = objCSpace.Charts.Add (0); //指定图表的类型。类型由OWC.ChartChartTypeEnum枚举值得到
objChart.Type = OWC.ChartChartTypeEnum.chChartTypeLine; //指定图表是否需要图例
objChart.HasLegend = true; //给定标题
objChart.HasTitle = true;
objChart.Title.Caption= pTitle;
//objChart.Title.Font.Bold=;
objChart.Title.Font.Color = "blue";
objChart.Title.Font.Italic = false;
objChart.Title.Font.Name = "隶书";
objChart.Title.Font.Size = 18;
objChart.Title.Font.Underline = c.owcUnderlineStyleSingle; //给定x,y轴的图示说明
objChart.Axes[0].HasTitle = true;
objChart.Axes[0].Title.Caption = pYValue;
objChart.Axes[1].HasTitle = true;
objChart.Axes[1].Title.Caption = pXValue;
string sCategory="";
string sValue="";
string sSeries="";
for (int i = 0; i < arrValueNames.Length; i++)
{
sSeries += arrValues[i].ToString();
sCategory += arrValueNames[i].ToString()+'\t';
sValue += arrValues[i].ToString()+'\t';
}
//添加一个series
objChart.SeriesCollection.Add(0);
//给定series的名字
objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimSeriesNames,
+ (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sSeries);
//给定分类
objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimCategories,
+ (int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sCategory);
//给定值
objChart.SeriesCollection[0].SetData (OWC.ChartDimensionsEnum.chDimValues,
(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral, sValue);
//输出成GIF文件.
objCSpace.ExportPicture(pSavePath, "GIF", pWidth, pHeight);
}
#endregion我用OWC写曲线图是 objChart.Title.Font.Color = "blue";
objChart.Title.Font.Italic = false;
objChart.Title.Font.Name = "隶书";
objChart.Title.Font.Size = 18;
objChart.Title.Font.Underline = c.owcUnderlineStyleSingle;这样设置title字体怎么不行啊,应该怎么设置,
还有我想在一个座标系中显示4条曲线图怎么实现(采购数量,采购金额,等)
发了个以前写的给你,代码很乱,当时是为了赶时间!思路挺简单的,就是通过SQL语句把数据提出来,通过一些加减的办法得到X、Y轴的具体坐标!
[email protected] 发的这个邮箱!
发了个以前写的给你,代码很乱,当时是为了赶时间!思路挺简单的,就是通过SQL语句把数据提出来,通过一些加减的办法得到X、Y轴的具体坐标!
[email protected] 发的这个邮箱!
--------------------------------------------------------------------------------
代码已经收到,感谢中......
等下我看看代码能不能用在我现在的项目中
http://blog.csdn.net/ChengKing/category/146827.aspx