关于显示数据曲线

bluecc 2002-09-01 05:46:58
如何在网页中显示数据曲线,即根据数据显示出曲线图来,就象股票网站里显示的趋势图一样.
...全文
64 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dreamforge 2002-09-02
  • 打赏
  • 举报
回复
用组件吧。OWC或MSCHART都可以。
qxxy_jan_jet 2002-09-02
  • 打赏
  • 举报
回复
可以自己用VB做一个控件嵌在网页中,
但IE常认为我做的控件不安全,弹出一个极为不友好的对话框
我也很困惑,大侠们,SOS!
fishwood 2002-09-01
  • 打赏
  • 举报
回复
一种简单的方法,可以根据数据循环写出table,用table背景色表示柱状高度。
bluecc 2002-09-01
  • 打赏
  • 举报
回复
TO antshome(我也.net了) :能不能具体一点,有什么控件可以用的,可不可以介绍一下。
TO horseman28(一天到晚睡觉的鱼):PHP怎么装在IIS上,还有在PHP里怎么实现画图。
TO gdmm(gdmm) ( ) :你的这个程序好象是画柱状图的,我要的是曲线图,也就是通过一组X,Y值制成曲线图。
gdmm 2002-09-01
  • 打赏
  • 举报
回复
<%
Sub ShowChart(ByRef aValues, ByRef aLabels, ByRef strTitle, ByRef strXAxisLabel, ByRef strYAxisLabel)
' Some user changable graph defining constants
' All units are in screen pixels
Const GRAPH_WIDTH = 450 ' The width of the body of the graph
Const GRAPH_HEIGHT = 250 ' The heigth of the body of the graph
Const GRAPH_BORDER = 5 ' The size of the black border
Const GRAPH_SPACER = 2 ' The size of the space between the bars

' Debugging constant so I can eaasily switch on borders in case
' the tables get messed up. Should be left at zero unless you're
' trying to figure out which table cells doing what.
Const TABLE_BORDER = 0
'Const TABLE_BORDER = 10

' Declare our variables
Dim I
Dim iMaxValue
Dim iBarWidth
Dim iBarHeight

' Get the maximum value in the data set
iMaxValue = 0
For I = 0 To UBound(aValues)
If iMaxValue < aValues(I) Then iMaxValue = aValues(I)
Next 'I
'Response.Write iMaxValue ' Debugging line


' Calculate the width of the bars
' Take the overall width and divide by number of items and round down.
' I then reduce it by the size of the spacer so the end result
' should be GRAPH_WIDTH or less!
iBarWidth = (GRAPH_WIDTH \ (UBound(aValues) + 1)) - GRAPH_SPACER
'Response.Write iBarWidth ' Debugging line


' Start drawing the graph
%>
<TABLE BORDER="<%= TABLE_BORDER %>" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD COLSPAN="3" ALIGN="center"><H2><%= strTitle %></H2></TD>
</TR>
<TR>
<TD VALIGN="center"><B><%= strYAxisLabel %></B></TD>
<TD VALIGN="top">
<TABLE BORDER="<%= TABLE_BORDER %>" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ROWSPAN="2"><IMG SRC="./images/spacer.gif" BORDER="0" WIDTH="1" HEIGHT="<%= GRAPH_HEIGHT %>"></TD>
<TD VALIGN="top" ALIGN="right"><%= iMaxValue %> </TD>
</TR>
<TR>
<TD VALIGN="bottom" ALIGN="right">0 </TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE BORDER="<%= TABLE_BORDER %>" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD VALIGN="bottom"><IMG SRC="./images/spacer_black.gif" BORDER="0" WIDTH="<%= GRAPH_BORDER %>" HEIGHT="<%= GRAPH_HEIGHT %>"></TD>
<%
' We're now in the body of the chart. Loop through the data showing the bars!
For I = 0 To UBound(aValues)
iBarHeight = Int((aValues(I) / iMaxValue) * GRAPH_HEIGHT)

' This is a hack since browsers ignore a 0 as an image dimension!
If iBarHeight = 0 Then iBarHeight = 1
%>
<TD VALIGN="bottom"><IMG SRC="./images/spacer.gif" BORDER="0" WIDTH="<%= GRAPH_SPACER %>" HEIGHT="1"></TD>
<TD VALIGN="bottom"><IMG SRC="./images/spacer_red.gif" BORDER="0" WIDTH="<%= iBarWidth %>" HEIGHT="<%= iBarHeight %>" ALT="<%= aValues(I) %>"></A></TD>
<%
Next 'I
%>
</TR>
<!-- I was using GRAPH_BORDER + GRAPH_WIDTH but it was moving the last x axis label -->
<TR>
<TD COLSPAN="<%= (2 * (UBound(aValues) + 1)) + 1 %>"><IMG SRC="./images/spacer_black.gif" BORDER="0" WIDTH="<%= GRAPH_BORDER + ((UBound(aValues) + 1) * (iBarWidth + GRAPH_SPACER)) %>" HEIGHT="<%= GRAPH_BORDER %>"></TD>
</TR>
<% ' The label array is optional and is really only useful for small data sets with very short labels! %>
<% If IsArray(aLabels) Then %>
<TR>
<TD><!-- Spacing for Left Border Column --></TD>
<% For I = 0 To UBound(aValues) %>
<TD><!-- Spacing for Spacer Column --></TD>
<TD ALIGN="center"><FONT SIZE="1"><%= aLabels(I) %></FONT></TD>
<% Next 'I %>
</TR>
<% End If %>
</TABLE>
</TD>
</TR>
<TR>
<TD COLSPAN="2"><!-- Place holder for X Axis label centering--></TD>
<TD ALIGN="center"><BR><B><%= strXAxisLabel %></B></TD>
</TR>
</TABLE>
<%
End Sub
%>
<%
' Static Chart (with Bar Labels)
ShowChart Array(6, 10, 12, 18, 23, 26, 27, 28, 30, 34, 37, 45, 55), Array("P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13"), "Chart Title", "X Label", "Y Label"


' Spacing
Response.Write "<BR>" & vbCrLf
Response.Write "<BR>" & vbCrLf
Response.Write "<BR>" & vbCrLf


' Random number chart
Dim I
Dim aTemp(49)

Randomize
For I = 0 to 49
aTemp(I) = Int((50 + 1) * Rnd)
Next 'I

' Chart made from random numbers (without Bar Labels)
ShowChart aTemp, "Note that this isn't an Array!", "Chart of 50 Random Numbers", "Index", "Value"
%>
horseman28 2002-09-01
  • 打赏
  • 举报
回复
嗯,我是在IIS上装了php解决的,php的gd库可以比较容易的实现。
antshome 2002-09-01
  • 打赏
  • 举报
回复
ASP做不到,要用组件生成图片或者在网页上使用ActiveX控件

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧