Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version
Go to top

Conversion of Reporting Starter Kit to use Mono/MySQL

, 1 Oct 2005
A porting of the ASP.NET reporting starter kit to use Mono, MySQL and Apache on a Linux system.
Reporting_Kit_Conversion_demo.zip
reports
bin
ASPNETReports.dll
ASPNETReports.dll.bak
MySql.Data.dll
MySql.Data.Tests.dll
components
bin
Release
ASPNETReports.dll
BLL
DAL
docs
images
1x1.gif
crosstabnestedcontrols.png
crosstabtotals.png
customers.gif
drilldownnestedcontrols.png
employees.gif
getorderdetails.gif
GetOrders.gif
hierarchicalpaging.gif
hierarchicalreport.gif
hierarchicalschema.gif
hierarchicalsorting.gif
masterdetaildetails.png
masterdetailsummary.png
masterdetailtables.png
querysample.gif
querysample2.gif
simpleoverview.png
simplesp.png
tabcolorcode.png
tabdetail.png
tabheader.gif
tabheader.png
tabnestedcontrols.png
tabsortshot.png
tabularextendedprice.png
textshot.gif
viscategorysales.gif
viscategorysales.png
vischartstructure.png
xtabsql.png
Global.asax
images
1x1.gif
asp.net-reports.gif
background.gif
crosstab.gif
crosstabnestedcontrols.png
crosstabtotals.png
customers.gif
drilldown.gif
drilldownnestedcontrols.png
employees.gif
getorderdetails.gif
GetOrders.gif
grid_background.gif
hierarchal.gif
hierarchical.gif
hierarchicalpaging.gif
hierarchicalreport.gif
hierarchicalschema.gif
hierarchicalsorting.gif
logo-neg.gif
logo.gif
masterdetail.gif
masterdetaildetails.png
masterdetails.gif
masterdetailsummary.png
masterdetailtables.png
matrix.gif
querysample.gif
querysample2.gif
report-table-bg.gif
reporting.gif
simple.gif
simpleoverview.png
simplesp.png
spacer.gif
tabcolorcode.png
tabdetail.png
tabheader.gif
tabheader.png
tabnestedcontrols.png
tabsortshot.png
tabular.gif
tabularcolorcode.png
tabularextendedprice.png
tabularsorting.png
text.gif
textalternate.gif
textreport.gif
textshot.gif
viscategorysales.gif
viscategorysales.png
vischartstructure.png
visual.gif
xtabsql.png
sourceviewer
1x1.gif
crosstab.src
drilldown.src
grid_background.gif
hierarchical.src
masterdetail.src
simple.src
tabular.src
textreport.src
visual.src
sql
<html>
	<head>
		<title>ASP.NET Reporting Documentation</title>
		<link rel="stylesheet" href="/reports/style.css">
	</head>
	<body class="NormalIndent">
		<h1>
			Visual.aspx Page
		</h1>
		<p>
			<b>Description:</b> &nbsp;&nbsp;&nbsp;The visual report shows Sales by Category 
			in three different views: Pie Chart, Bar Graph, and Tabular.
		</p>
		<p>
			<strong>Overview:</strong> &nbsp;&nbsp;&nbsp; The visual report uses GDI+, the 
			infrastructure for creating images and graphics in .NET, to dynamically 
			generate pie charts and bar graphs.
		</p>
		<p>The user can choose the view for the data. The first view by default is a Pie 
			Chart. The Pie Chart illustrates the contribution of sub values to a total. The 
			second view is the Bar Graph. The Bar Graph displays side-by-side values for 
			comparison between different values. The last view is the Tabular view, which 
			displays the data used for the Pie Chart and the Bar Graph. The Pie Chart and 
			the Bar Graph have color coded values and an accompanying legend.
		</p>
		<P><strong>Implementation Notes:&nbsp;</strong> &nbsp;To dynamically generate a 
			graph or chart image, a separate web page is necessary for the GDI+ functions 
			to output the generated image directly to the web page output 
			stream.&nbsp;&nbsp; This is the reason that Visual.aspx page refers to 
			ChartGenerator.aspx page for the ImageUrl source.
		</P>
		<P>In this implementation, the ChartGenerator.aspx page gets its parameters via the 
			query string for simplicity and calls the necessary components, BarGraph and 
			PieChart, to render the requested image.&nbsp;&nbsp; This is an example on how 
			the page is invoked:
		</P>
		<pre>
		<P>http://localhost/ReportsWeb/ChartGenerator.aspx?<font color= "blue">xValues</font>=Beverages,Condiments,Confections,DairyProducts,
Grains/Cereals,Meat/Poultry,Produce,Seafood&amp;<font color= "blue">yValues</font>=267868.180522919,106047.084989548,167357.224831581,
234507.285217285,95744.587474823,163022.359088898,99984.5800685882,131261.73742485&amp;<font color= "blue">ChartType</font>=pie&amp;<font color= "blue">Print</font>=False</P>
		</pre>
		<P>For better image quality, the page outputs the graph in PNG format (Note that 
			the PNG format is not supported in Netscape 4.x browsers).&nbsp;&nbsp;Since the 
			image is in PNG format, the Bitmap object cannot write directly to 
			Response.OutputStream because the OutputStream does not support the random seek 
			feature that PNG requires.&nbsp;&nbsp;To get around this issue, MemoryStream is 
			used to temporarily save the Bitmap object.&nbsp; The resulting MemoryStream is 
			then written to the page's OutputStream.
		</P>
		<P>Given that ChartGenerator.aspx does all the graphic work, the Visual.aspx page 
			only acts as a user friendly interface to gather all the necessary input and 
			data for creating the correct graph or chart.
		</P>
		<P><strong>BarGraph and PieChart&nbsp;</strong>
		</P>
		<p>
			<img src="/reports/images/1x1.gif" width="25"> <img src="../images/vischartstructure.png">
		</p>
		<P>As mentioned earlier, the BarGraph and PieChart classes call all the necessary 
			GDI+ functions to create images dynamically.&nbsp;&nbsp;Before delving into how 
			they work, consider the chart architecture above.
		</P>
		<P>BarGraph and PieChart inherit some of the basic functionalities from the 
			ChartItem, ChartItemCollections, and Chart classes.&nbsp;&nbsp;ChartItem 
			represents a single data point and contains enough information to be used for 
			drawing the item in the chart.&nbsp; ChartItemCollections is just an 
			implementation of chart item collection.&nbsp;&nbsp;Finally, Chart is meant to 
			define a standard interface for all custom graph implementations that derive 
			from it.
		</P>
		<P>Implementing BarGraph and PieChart is not a simple matter, and even though it is 
			simple enough to use the GDI+ features, the daunting task is left on formatting 
			and calculating the graph�s dimension.&nbsp;&nbsp;Some examples of GDI+ calls:
		</P>
		<pre>
		<P>ChartItem item = (ChartItem) _chartItems[i];
SolidBrush brs = new SolidBrush(item.ItemColor);
grp.<font color= "blue">FillPie</font>(brs, pieRect, item.StartPos, item.SweepSize);
grp.<font color= "blue">FillRectangle</font>(brs, perimeter + _bufferSpace, i * _legendFontHeight + 15, 10, 10);
grp.<font color= "blue">DrawString</font>(item.Label, new Font(_legendFontStyle, _legendFontSize), 
   new SolidBrush(Color.Black), perimeter + _bufferSpace + 20, i * _legendFontHeight + 13);

grp.<font color= "blue">DrawString</font>(item.Value.ToString("C"), new Font(_legendFontStyle, _legendFontSize), 
   new SolidBrush(Color.Black), perimeter + _bufferSpace + 200, i * _legendFontHeight + 13,sf);</P>
		</pre>
		<P>
		&nbsp;
		<P>These are some points to keep in mind when implementing a bar graph:
			<UL>
				<li>
				Spend time designing the graph on paper during the design phase before 
				implementing it.
				<li>
				Calculate in advance all of the dimensions and measurements for each part of 
				the chart.
				<LI>
					Make sure the graph scales correctly given any number of data points.
				</LI>
			</UL>
		<P>&nbsp;</P>
	</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

StylezHouse
Web Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.140922.1 | Last Updated 1 Oct 2005
Article Copyright 2005 by StylezHouse
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid