老板要把我逼死了。。。加100大粪,征求答案。

zytang 2001-02-13 08:52:00
我用ASP做网页,连接数据库。
有一个表中有4个字段,为 fieldA,fieldB,fieldC,fieldD,都是数值型,
每次刷新网页时,显示4个值,即4个字段值各占fieldA + fieldB + fieldC + fieldD之和的百分比。
如:
fieldA=10
fieldB=30
fieldC=40
fieldD=20

网页显示的四个值为10%,30%,40%,20%

但是可恶的老板要我用“饼图”表示,画不出“饼图”,我就只能画饼充饥了。

请各路大仙、大虾指条明路。
务必具体一些。

...全文
3842 73 打赏 收藏 转发到动态 举报
写回复
用AI写文章
73 条回复
切换为时间正序
请发表友善的回复…
发表回复
daviszhang 2001-02-19
  • 打赏
  • 举报
回复
查ASP的文档就OK
LHA 2001-02-19
  • 打赏
  • 举报
回复
自己写一个Java小程序
czh 2001-02-19
  • 打赏
  • 举报
回复
可以用Lotus公司的Esuit,它是一套用Java做的类似于Office功能的小程序,用Javascript可以访问它的属性和方法,作三维图很简单,作电子表格也很方便,可惜速度很慢。
coolknight 2001-02-18
  • 打赏
  • 举报
回复
看看我的站点http://aspfans.yeah.net,三维饼图,几行代码搞定,其实很简单的,用不着那么复杂,在网上找一个免费的可以自动生成jpg图形的dll组建就OK了,我的站点有download
newyonger 2001-02-18
  • 打赏
  • 举报
回复
非常关注!
online 2001-02-15
  • 打赏
  • 举报
回复
给你一段代码,对你应该是有帮助的
<%@ Language=VBScript %>
<% OPTION EXPLICIT %>
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</head>
<body>

<!-- #INCLUDE FILE="ExcelChart.inc" -->

<%
Dim iStartYear, iEndYear
Dim strFactory, strRSMode
Dim flgRSFromDatabase

'--- read the starting year submitted from the form
iStartYear = Request.Form( "iYear" )
if( IsEmpty(iStartYear) or IsNull(iStartYear)) then iStartYear = 1991

'--- compute the ending year based on start year
iEndYear = CInt(iStartYear)+4

'--- get the factory for which production is to be shown
strFactory = Request.Form( "strFactory" )
if( IsEmpty(strFactory) or IsNull(strFactory)) then strFactory = "FACTORY 1"

'--- determine if data is to be picked up from database, recordset mode
strRSMode = Request.Form( "chbRSMode" )

'--- flgRSFromDatabase = false means build recordset thru scripts without database
if( not IsEmpty(strRSMode) and not IsNull(strRSMode) and strRSMode = "on" ) then flgRSFromDatabase = False else flgRSFromDatabase = True
%>

<%
Dim oRs
Dim oConnection
Dim strQuery

'--- recordset from database
if( flgRSFromDatabase = true ) then
'--- create the connection object
Set oConnection = Server.CreateObject("ADODB.Connection" )

'--- open the connection
'oConnection.Open "DBQ="+server.mappath("CHARTDATA.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
oConnection.Open "DBQ="+server.mappath("CHARTDATA.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
'--- build the query string
strQuery = "SELECT * FROM yearly_production WHERE factory_name='"+strFactory+"' AND production_year BETWEEN "+CStr(iStartYear)+" AND "+CStr(iEndYear)

Set oRs = oConnection.Execute( strQuery )


if( oRs.EOF ) then
Response.Write( "No data available" )
Response.End
end if

else

Set oRs = Server.CreateObject("ADODB.Recordset" )

with oRs
.CursorLocation = 3 '--- client-side cursor
with .Fields
.Append "factory_name", adVarChar
.Append "production_year",adInteger
.Append "production_in_tons",adInteger
end with

.Open '-- open the recordset

'--- add records
.AddNew Array("factory_name","production_year", "production_in_tons"), Array( strFactory, iStartYear, "50" )
.AddNew Array("factory_name","production_year", "production_in_tons"), Array( strFactory, iStartYear+1, "160" )
.AddNew Array("factory_name","production_year", "production_in_tons"), Array( strFactory, iStartYear+2, "90" )
.AddNew Array("factory_name","production_year", "production_in_tons"), Array( strFactory, iStartYear+3, "120" )
.AddNew Array("factory_name","production_year", "production_in_tons"), Array( strFactory, iStartYear+4, "200" )

'--- update
.Update
end with
end if
%>

<%
Dim oExcelChart
Dim strGIFFileName


Set oExcelChart = Server.CreateObject( "ExcelChart.cExcelChart" )

oExcelChart.AddDataSeries oRs, "production_in_tons", "Production", False, True


oExcelChart.SetXAxisHeadings oRs, "production_year"


oExcelChart.SetChartTitles "Tea production for 5 year period", "Year", "Production"


oExcelChart.SetChartOptions xl3DArea, 400, 200 'xl3DColumnClustered


oExcelChart.SetBackgroundEffect msoGradientChrome ' msoGradientCalmWater


strGIFFileName = CStr( Server.MapPath(".") & "\"+ "EXCELCHART.GIF" )


oExcelChart.ExportToGif( strGIFFileName )


Set oExcelChart = nothing
Set oRs = nothing
Set oConnection = nothing
%>


<img SRC="ExcelChart.GIF"> '在html调用即可

<!-- for debugging only -->
<%
'oRs.MoveFirst
'while( not oRs.EOF )
' Response.Write( "<BR>Year:" + CStr(oRs("production_year")) + "Factory:" + oRs("factory_name") + "Production:" + CStr(oRs("production_in_tons")))
' Factory:'"&oRs("factory_name")+ "'Production:"&oRs("production_in_tons"))
' oRs.MoveNext
' wend

' Set oRs = nothing
'Set oConnection = nothing
%>


</body>
</html>
zytang 2001-02-15
  • 打赏
  • 举报
回复
ndd(我爱VB),您好:
“修改ACITVEDLL应该不需要启动计算机吧”
请问你的操作步骤。
zytang 2001-02-15
  • 打赏
  • 举报
回复
ndd(我爱VB),您好:
“savepicture picture1.image(应该是)保存的是bmp文件”的方法只能在用了LOADPICTURE之后才能有效,
我的意图是“将Picture控件中用mousemove画出的线条保存到硬盘上”
用以上方法保存的图片是空白的。
oldfarmer 2001-02-15
  • 打赏
  • 举报
回复
你看看www.banby.com,下面那个计数器就是用VJ写的JavaApplet,用它实现饼图也很方便。主流浏览器都支持。
ndd 2001-02-15
  • 打赏
  • 举报
回复
to zytang

将PICTURE的图片保存可以用 savepicture picture1.image(应该是)保存的是bmp文件,可以用其它的工具转达换成其它格式
修改ACITVEDLL应该不需要启动计算机吧,也太麻烦了,以前做过,应该不用
ndd 2001-02-15
  • 打赏
  • 举报
回复
我没作过^_*,但我觉得生成一个图片,放在生成的页面中的方法最科学,这样对访问者没有什么要求,你可以看看,浏览股市站点看到的图都是在服务端生成后传给浏览器的图片,而不是要求用户有XX控件,我们的页面计数器不也是实时生成的图片吗?
oldfarmer 2001-02-15
  • 打赏
  • 举报
回复
两种解决方案:

一、写JavaApplet嵌入IE实现饼图。需要自己写JavaApplet
二、使用ASPImage这个组件很容易就可以画出来。这个组件好像需要注册!
zytang 2001-02-15
  • 打赏
  • 举报
回复
http://lzzqqq.home.chinaren.com/
看见了。

很棒。

加分,
但我自己的分也不多了。
zytang 2001-02-15
  • 打赏
  • 举报
回复
再请教问题:
1、如何将Picture控件中用mousemove画出的线条保存到硬盘上,格式分别为*.bmp*.jpg*.gif
2、Active DLL除了在ASP中调用,还可以在那里使用,请举例说明。
3、Active DLL 和 Active exe有什么区别
4、难道每次修改了Active DLL源代码,要调试时,都要先从新启动计算机,清空内存后,再注册Active DLL,才能运行调试吗?这也太麻烦了。


谢谢
zytang
amuluo 2001-02-15
  • 打赏
  • 举报
回复
你画个圆啊。然后用上色的办法给里面的色彩上值。不就成了一个多色彩的贺*O&
zytang 2001-02-15
  • 打赏
  • 举报
回复
我用的是校园网,代理服务器,不能用oicq.
tel:021-65710016
crackx 2001-02-15
  • 打赏
  • 举报
回复
用mschart控件要装Office的!
lzzqqq 2001-02-15
  • 打赏
  • 举报
回复
等到22:50,oicq没反应就增睡觉啊!!
lzzqqq 2001-02-15
  • 打赏
  • 举报
回复
到 http://lzzqqq.home.chinaren.com/ 看一下,准保你满意!
不过我给你发过去后,你要给我分!!!
lzzqqq 2001-02-15
  • 打赏
  • 举报
回复
我太傻了,用oicq 就可以把文件给你传过去,我的oicq 已经告诉你了啊!!???
为什么我的oicq还没反应?,莫非你不要aspchart了???!!!
加载更多回复(53)

7,786

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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