📄 g03.aspx
字号:
<%@ Page Language="VB" Description="dotnetCHARTING Component"%>
<%@ Register TagPrefix="dotnet" Namespace="dotnetCHARTING" Assembly="dotnetCHARTING"%>
<%@ Import Namespace="System.Drawing" %>
<script runat="server">
Private Function getData() As SeriesCollection
Dim SC As New SeriesCollection()
Dim myR As New Random()
Dim i As Integer
For i = 0 To 0
Dim s As New Series()
s.Name = "X Company"
Dim startPrice As Double = 50
Dim startDT As New DateTime(2000, 1, 1)
Dim b As Integer
For b = 0 To 74
Dim e As New Element()
e.XDateTime = startDT
startDT = startDT.AddDays(1)
e.Open = startPrice
If myR.Next(10) > 5 Then
startPrice += myR.Next(5)
Else
startPrice -= myR.Next(3)
End If
e.Close = startPrice
e.Volume = myR.Next(100)
If e.Open > e.Close Then
e.High = e.Open + myR.Next(6)
e.Low = e.Close - myR.Next(6)
Else
e.High = e.Close + myR.Next(6)
e.Low = e.Open - myR.Next(6)
End If
s.Elements.Add(e)
Next b
SC.Add(s)
Next i
Return SC
End Function 'getData
Sub Page_Load(sender As [Object], e As EventArgs)
' Set the title.
Chart.Title = "My Chart"
' Set 3D
Chart.Use3D = True
' Set the chart Type
Chart.Type = ChartType.Financial
' Label the chart areas
Chart.PriceArea.Label.Text = "Stock Price for X Company"
Chart.VolumeArea.Label.Text = "Volume"
' Set the financial chart type
Chart.DefaultSeries.Type = SeriesTypeFinancial.Bar
' Set the legend template
Chart.LegendBox.Template = "IconName"
' Set the directory where the images will be stored.
Chart.TempDirectory = "temp"
' Set the format
Chart.VolumeArea.XAxis.FormatString = "d"
' Set the time padding for the x axis.
Chart.VolumeArea.XAxis.TimePadding = New TimeSpan(5, 0, 0, 0)
' Set he chart size.
Chart.Size = "600x350"
' Add the random data.
Chart.SeriesCollection.Add(getData())
End Sub 'Page_Load
</script>
<HTML><HEAD><TITLE>Gallery Sample</TITLE></HEAD>
<BODY>
<DIV align=center>
<dotnet:Chart id="Chart" runat="server"/>
</DIV>
</BODY>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -