i want to use data set instead of arrays
can any one help
thanks
---------------------------------
<%@ Import Namespace="Syst em.Drawing" %>
<%@ Import Namespace="Syst em.Drawing.Imag ing" %>
<script runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
'Declare your object variables
Dim i As Integer
'Build a BitMap that will act as the pallet and container
'for the bar graph. Here 600 is the width and 300 is the height.
'These values could also be passed as parameters.
Dim objBitMap As New Bitmap(600, 550)
'Declare your Graphics objects for painting graphics on you newly created bitmap.
Dim objGraphics As Graphics
objGraphics = Graphics.FromIm age(objBitMap)
'Set the background color to silver
objGraphics.Cle ar(Color.White)
'Build an array of values for the bar and pie chart.
'These values could also be pulled from a database.
Dim arrValues(4) As Integer
arrValues(0) = 100
arrValues(1) = 135
arrValues(2) = 115
arrValues(3) = 125
arrValues(4) = 230
Dim arrValueNames(4 ) As String
arrValueNames(0 ) = "Biz"
arrValueNames(1 ) = "Basic"
arrValueNames(2 ) = "website"
arrValueNames(3 ) = "quest"
arrValueNames(4 ) = "image"
'Write out a title for your bar and pie chart.
objGraphics.Dra wString("5 Top Techno Books", New Font("Tahoma", 16), Brushes.Black, New PointF(5, 5))
'Create a legend to describe your bar and chart.
Dim symbolLeg As PointF = New PointF(445, 20)
Dim descLeg As PointF = New PointF(390, 16)
For i = 0 To arrValueNames.L ength - 1
objGraphics.Fil lRectangle(New SolidBrush(GetC olor(i)), symbolLeg.X, symbolLeg.Y, 20, 10)
objGraphics.Dra wRectangle(Pens .Black, symbolLeg.X, symbolLeg.Y, 20, 10)
objGraphics.Dra wString(arrValu eNames(i).ToStr ing, New Font("Tahoma", 10), Brushes.Black, descLeg)
symbolLeg.Y += 15
descLeg.Y += 15
Next i
'Loop through the values to create the Pie Chart.
Dim sglCurrentAngle As Single = 0
Dim sglTotalAngle As Single = 0
i = 0
For i = 0 To arrValues.Lengt h - 1
'Current Value / (sum of all the Values) * 360 degree angle
sglCurrentAngle = arrValues(i) / 705 * 360
objGraphics.Fil lPie(New SolidBrush(GetC olor(i)), 120, 95, 400, 400, sglTotalAngle, sglCurrentAngle )
objGraphics.Dra wPie(Pens.Black , 120, 95, 400, 400, sglTotalAngle, sglCurrentAngle )
sglTotalAngle += sglCurrentAngle
Next i
objBitMap.Save( Response.Output Stream, ImageFormat.Gif )
End Sub
Private Function GetColor(ByVal itemIndex As Integer) As Color
Dim objColor As Color
Select Case itemIndex
Case 0
objColor = Color.Blue
Case 1
objColor = Color.Red
Case 2
objColor = Color.Yellow
Case 3
objColor = Color.Purple
Case 4
objColor = Color.Orange
Case 5
objColor = Color.Brown
Case 6
objColor = Color.Gray
Case 7
objColor = Color.Maroon
Case Else
objColor = Color.Green
End Select
Return objColor
End Function
</script>
0 3509 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Brian Shade |
last post by:
Hi all. I am having a bit of a problem with my Perl script and the
creation of a chart. I can create the chart and create a new
SeriesCollection. I then specify the XValues and the Values parameter
of the first SeriesCollection object. I add another SeriesCollection,
but I am only able to set the XValues and I get the following error
when I try to set the Values parameter:
OLE exception from "Microsoft Office Excel":
Unable to set the...
|
by: Prabhakar |
last post by:
Friends,
I have been migrating ASP applications from IIS4.0/NT4.0 to
IIS5.0/W2K. All the applications working perfectly except one. This
particular application will make use of asp chart object.
Sub BuildGraph(rate(), name,color,chartHight,chartWidth)
|
by: Jim |
last post by:
I have this chart on a form. I'm trying to get this chart to render only if
the user chooses to do so. This because of that the chart is quite complex
and takes some time to render.
I know that I probably should put it on a report and call that report from
the form but for various reasons I need the chart on this form.
In a table bound to this form I have a Yes/No field and then from a checkbox
the user should get to choose if the form is...
|
by: PeteCresswell |
last post by:
I've been to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp,
but still don't have a clue.
For example, I've got a chart object namde 'grphStats' in a form named
frmChart.
?Forms!frmChart!grphStats.Name returns "grphStats" as expected, but
I can't get any further.
|
by: StBond |
last post by:
Hi everyone,
I am new to Access and Visual Basic so things my be getting across a
bit cloudy. I only started using VB for one week.
I am having a little problem with the database that I am working on. I
am working with MS Access 2002. And I am having a problem with one of
my charts.
I will explain how everything is laid out then go into details.
| |
by: Patrick.O.Ige |
last post by:
I have a code below and its a PIE & BAR CHART.
The values now are all static but I want to be able to pull the values from
a database.
Can you guys give me some ideas to do this?
Thanks
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Declare your object variables
|
by: Robin Tucker |
last post by:
Heres and interesting problem:
I have a VB.NET program that creates reports via. Word Automation. This all
works fine. What I want to do as part of this report generation process is
to embed a graph/chart within the report, once again from VB.NET. I have
chosen to use Excel.Chart.8. So, to embed I do this from VB.NET:
Dim theNewShape As InlineShape = m_Document.InlineShapes.AddOLEObject
(ClassType:="Excel.Chart", _
|
by: Scott H. |
last post by:
Hello:
I am trying to use Crystal Reports from VS.NET 2003 to produce a simple line
chart, where the x axis represents the number of measurements taken and the y
axis represents the range of measurement values. There are two sets of points
or measurements, so I would like a line on the chart for each set of values
(two lines).
I can produce the line chart on a VB.NET form correctly using an
Infragistics UltraChart obeject. The data...
|
by: Saintor |
last post by:
This is for A97 in runtime or MDE mode.
My intent was to define a temporary query using the recordsetclone property
/ filter / orderby. The controlsource of my chart would be based on a
grouped query based on this temporary query.
Is this the best way or is there another one more efficient?
Is it possible in a runtime environment to change the format of an axis (by
Week ---> by Month) or the chart controlsource on report opening?
|
by: cubekid |
last post by:
I am using OWC 11 in my new web application for displaying charts.
Is it possible in OWC 11 to combine and display a column and a line graph (Looking like they overlap each other)?
I tried it using this code but it doesn' t work.
int width = 400;
int height = 300;
Bitmap bmpChart = new Bitmap(width, height, PixelFormat.Format16bppRgb555);
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |