本文介绍了如何在按钮中使用ZedGraph的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友,
我正在asp.net中做一个项目,我想显示一个使用ZedGraph dll的图形.现在,我在项目中显示与数据相对应的图形
但是现在我遇到了一个问题,就是该页面加载后该图始终可见.
而且我希望该图仅显示一个按钮单击事件..
当我单击按钮时,Friends plz帮助我显示此图.
现在正在使用此代码:
Hi Friends,
I am doing a project in asp.net, and I want to show a graph using ZedGraph dll. Now I show the graph in my project corresponding to the data
but now I faced a problem that is that graph is always visible when that page is loaded.
And I want that graph shows only a button click event..
Friends plz help me to show this graph when I clicked a button.
Now am using This Code:
Private Sub OnRenderGraph1(ByVal zgw As ZedGraphWeb, ByVal g As System.Drawing.Graphics, _
ByVal masterPane As ZedGraph.MasterPane) Handles ZedGraphWeb1.RenderGraph
'Dim myPane As GraphPane = zgc.GraphPane
Dim myPane As GraphPane = masterPane(0)
Dim num As Integer
Dim Xcount As Integer
' Set the titles and axis labels
myPane.Title.Text = "LBS Financials – All Practices - April 2011 - November 2010"
myPane.XAxis.Title.Text = "Month/Year"
myPane.YAxis.Title.Text = "Values In ($)"
Xcount = gvFinancialSummaryReport.Rows.Count - 1
Dim y1(Xcount), y2(Xcount), Y3(Xcount), Y4(Xcount), y5(Xcount), y6(Xcount), _
y7(Xcount), y8(Xcount) As Double
Dim Xlabels(Xcount) As String
For num = 0 To Xcount
Xlabels(num) = gvFinancialSummaryReport.Rows(num).Cells(0).Text
y1(num) = gvFinancialSummaryReport.Rows(num).Cells(1).Text
y2(num) = gvFinancialSummaryReport.Rows(num).Cells(2).Text
Y3(num) = gvFinancialSummaryReport.Rows(num).Cells(3).Text
Y4(num) = gvFinancialSummaryReport.Rows(num).Cells(4).Text
y5(num) = gvFinancialSummaryReport.Rows(num).Cells(5).Text
y6(num) = gvFinancialSummaryReport.Rows(num).Cells(6).Text
y7(num) = gvFinancialSummaryReport.Rows(num).Cells(7).Text
If gvFinancialSummaryReport.Rows(num).Cells(8).Text = "" Then
y8(num) = 0
Else
y8(num) = gvFinancialSummaryReport.Rows(num).Cells(8).Text
End If
Next
' Generate a red bar with "Charges" in the legend
Dim myBar As BarItem = myPane.AddBar("Charges", Nothing, y1, Color.Red)
myBar.Bar.Fill = New Fill(Color.Red, Color.White, Color.Red)
' Generate a blue bar with "Insurance Payments" in the legend
myBar = myPane.AddBar("Insurance Payments", Nothing, y2, Color.Blue)
myBar.Bar.Fill = New Fill(Color.Blue, Color.White, Color.Blue)
' Generate a green bar with "Patient Payments" in the legend
myBar = myPane.AddBar("Patient Payments", Nothing, Y3, Color.Green)
myBar.Bar.Fill = New Fill(Color.Green, Color.White, Color.Green)
' Generate a DarkTurquoise bar with "Total Collections" in the legend
myBar = myPane.AddBar("Total Collections", Nothing, Y4, Color.DarkTurquoise)
myBar.Bar.Fill = New Fill(Color.DarkTurquoise, Color.White, Color.DarkTurquoise)
' Generate a Black bar with "Insurance Adjustments / Write-offs" in the legend
myBar = myPane.AddBar("Insurance Adjustments / Write-offs", Nothing, y5, Color.Black)
myBar.Bar.Fill = New Fill(Color.Black, Color.White, Color.Black)
' Generate a DarkSalmon bar with "Receipt Adjustments" in the legend
myBar = myPane.AddBar("Receipt Adjustments", Nothing, y6, Color.DarkSalmon)
myBar.Bar.Fill = New Fill(Color.DarkSalmon, Color.White, Color.DarkSalmon)
' Generate a DarkMagenta bar with "Insurance AR" in the legend
myBar = myPane.AddBar("Insurance AR", Nothing, y7, Color.DarkMagenta)
myBar.Bar.Fill = New Fill(Color.DarkMagenta, Color.White, Color.DarkMagenta)
' Generate a DarkKhaki bar with "Insurance A/R Days" in the legend
myBar = myPane.AddBar("Insurance A/R Days", Nothing, y8, Color.DarkKhaki)
myBar.Bar.Fill = New Fill(Color.DarkKhaki, Color.White, Color.DarkKhaki)
' Draw the X tics between the labels instead of at the labels
myPane.XAxis.MajorTic.IsBetweenLabels = True
' Set the XAxis labels
myPane.XAxis.Scale.TextLabels = Xlabels
' Set the XAxis to Text type
myPane.XAxis.Type = AxisType.Text
' Fill the axis area with a gradient
myPane.Chart.Fill = New Fill(Color.White, _
Color.FromArgb(255, 255, 166), 90.0F)
' Fill the pane area with a solid color
myPane.Fill = New Fill(Color.FromArgb(250, 250, 255))
masterPane.AxisChange(g)
'BarItem.CreateBarLabels(myPane, False, "f0")
'myPane.YAxis.Scale.Max += myPane.YAxis.Scale.MajorStep
End Sub
请帮帮我.
谢谢.
Please help me.
Thanks.
推荐答案
请帮帮我.
谢谢.
Please help me.
Thanks.
这篇关于如何在按钮中使用ZedGraph的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!