How to create a statistical chart in ASP

Source: Internet
Author: User
The following describes a common function and its use case. For more information, see.
<%
REM first we design a ShowCart function, where
REM aValues is a numerical array.
REM aLables is the x coordinate label.
REM strTitle is the title of this statistical chart.
REM strXAxisLable labels on the x axis
REM strYAxisLable Y axis label
Sub ShowChart (ByRef aValues, ByRef aLabels, ByRef strTitle, ByRef strXAxisLabel, ByRef strYAxisLabel)
'You can change the graph constant at will.
The unit is the screen pixel.
Const GRAPH_WIDTH = 450 'image width
Const GRAPH_HEIGHT = 250 'image
Const GRAPH_BORDER = 5' coordinate line width
Const GRAPH_SPACER = 2'
Const TABLE_BORDER = 0
'Variable declaration
Dim I
Dim iMaxValue
Dim iBarWidth
Dim iBarHeight
'Get the maximum value of aValues
IMaxValue = 0
For I = 0 To UBound (aValues)
If iMaxValue <aValues (I) Then iMaxValue = aValues (I)
Next 'I
'Calculate the width of each graph
IBarWidth = (GRAPH_WIDTH (UBound (aValues) + 1)-GRAPH_SPACER
'Start plotting
%>
<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>
& Nbsp; & n bsp; <td rowspan = '2'> '> </TD>
<Td valign = 'top' ALIGN = 'right'> <% = iMaxValue %> </TD>
& Nbsp; </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 '> 'height =' <% = GRAPH_HEIGHT %> '> </TD>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.