The application of Chart Component in ASP
Last Update:2017-02-28
Source: Internet
Author: User
--------------------------------------------------------------------------------
MSChart is a powerful charting tool made by Microsoft that can
Easy to create a variety of charts. Make a variety of 3-D 2-D histogram, folding
Line diagram. In chinaasp, there have been several times when someone asked MSChart how
I'll give you an example here. I hope you understand.
Send Data program
<HTML><HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
</HEAD><BODY>
<form method=post name= "Form1" action=mschart.asp>
<input type= "Submit" value= "send" id=submit1 name=submit1>
<!
ChTitle Title
Number of Rcount columns
Ccount Number of rows
Rc_type Arrangement (1 in rows, 2 in column mode)
Rc_data data
Rname Column Array Group
CNAME line array group >
<input type= "hidden" value= "Coolfatman growth mileage" name=chtitle>
<input type= "hidden" value=3 name=rcount>
<input type= "hidden" value=2 name=ccount>
<input type= "hidden" value=1 name=rc_type>
<input type= "hidden" value= "1993" Name=rname>
<input type= "hidden" value= "1996" Name=rname>
<input type= "hidden" value= "1999" Name=rname>
<input type= "hidden" value= "height" name=cname>
<input type= "hidden" value= "weight" name=cname>
<input type= "hidden" value=179 name=rc_data>
<input type= "hidden" value=160 name=rc_data>
<input type= "hidden" value=180 name=rc_data>
<input type= "hidden" value=170 name=rc_data>
<input type= "hidden" value=182 name=rc_data>
<input type= "hidden" value=182 name=rc_data>
</form></BODY></HTML>
Display Data Program mschart.asp
<%@ Language=vbscript%>
<HTML>
<HEAD>
<meta name= "generator" content= "Microsoft Visual Studio 6.0" >
<script Id=clienteventhandlersjs language=javascript>
<!--
function Window_onload () {
t=0;
MSChart1. TitleText = Document.form1.chtitle.value;
MSChart1. ShowLegend =true;
MSChart1. ColumnCount =document.form1.ccount.value;
MSChart1. RowCount =document.form1.rcount.value;
for (i=0;i<document.form1.rcount.value;i++)
{for (j=0;j<document.form1.ccount.value;j++)
{MSChart1. row=i+1;
MSChart1. column=j+1;
if (document.form1.ccount.value>1)
MSChart1. ColumnLabel =document.form1.cname (j). Value;
Else
MSChart1. ColumnLabel =document.form1.cname.value;
if ((document.form1.rcount.value*document.form1.ccount.value) >1)
MSChart1. Data=document.form1.rc_data (t). value;
Else
MSChart1. Data=document.form1.rc_data.value;
t++;
}
if (document.form1.rcount.value>1)
MSChart1. RowLabel =document.form1.rname (i). value;
Else
MSChart1. RowLabel =document.form1.rname.value;
}
}
function Select1_onchange () {
Mschart1.charttype =select1.value
MSChart1. Plot
}
-->
</SCRIPT>
<TITLE> Data Display Chart </TITLE>
</HEAD>
<body language=javascript >
<object Insert MSChart ActiveX control here >
<BR>
Display mode
<select Id=select1 Name=select1 language=javascript >
<option value=1> Two-dimensional histogram </OPTION>
<option value=0> Three-dimensional histogram </OPTION>
<option value=3> Two-dimensional line chart </OPTION>
<option value=2> three-dimensional line chart </OPTION>
<option value=5> Two-dimensional area map </OPTION>
<option value=4> three-dimensional area chart </OPTION>
<option value=14> pie chart </OPTION></SELECT>
<!
ChTitle Title
Number of Rcount columns
Ccount Number of rows
Rc_type Arrangement (1 in rows, 2 in column mode)
Rc_data data
Rname Column Array Group
CNAME line array group >
<form Name=form1 id=form1>
<% for I=1 to Request.Form ("Rcount")%>
<input type= "hidden" name=rname id=rname value=<%=request.form ("Rname") (i)%>>
<%next%>
<% for I=1 to Request.Form ("Ccount")%>
<input type= "hidden" name=cname id=cname value=<%=request.form ("CNAME") (i)%>>
<%next%>
<input type= "hidden" Name=rcount id=rcount value=<%=request.form ("Rcount")%>>
<input type= "hidden" name=chtitle id=chtitle value=<%=request.form ("ChTitle")%>>
<input type= "hidden" Name=ccount id=ccount value=<%=request.form ("Ccount")%>>
<%if Request.Form ("Rc_type") =1 then%>
<%for I=1 to Request.Form ("Rcount") *request.form ("Ccount")%>
<input type= "hidden" name=rc_data id=rc_data value=<%=request.form ("Rc_data") (i)%>>
<%next%>
<%else%>
<%for j=1 to Request.Form ("Rcount")%>
<%for I=1 to Request.Form ("Ccount")%>
<input type= "hidden" name=rc_data id=rc_data value=<%=request.form ("Rc_data") ((i-1) *request.form ("Rcount") +j )%>>
<%next%>
<%next%>
<%end if%>
</form></BODY></HTML>