OWC seems to be mostly used by many users, but some netizens complained in the post that OWC needed a License book for use, so they excluded it, I don't want the BOSS to pop up a "no license book" window when reading the report.
Then we found the various types of ComponentOne Web charts, with excellent results. I was so fascinated by it that I decided to keep it. So I immediately went down to the installation file of the latest version of 100 M and found a usable registration code in the morning, and I found another tutorial, OK, everything is ready, and you are eager to start writing code. The requirement is not complex. Just draw multiple line charts on a single page. Based on past experience, this large commercial sharing software can definitely deal with two Example on the official site for at most one hour. However, I am very annoyed by the results. The official Example is simply not provided. What AJAX do you get and a lot of code to implement the auxiliary effect, the three or four lines of the core you are looking for cannot be found, as if you were afraid that you would suddenly understand its Example. I have always hated such software. As a result, a day has passed.
Fortunately, I found the Web Chart. The code is super concise and the effect is good. Write some simple examples of ASP. NET Report controls for your reference:
ASP. NET Report controls 1. line chart
- // Reference the namespace
- Using WebChart;
-
- // Define a color array to fill different colors for different records during the loop
- Private string []MyColor=NewString []
- {
- "Tomato", // Tomato
- "Black ",
- "Gold ",
- "Blue ",
- "Green ",
- "Orange ",
- "Pink", // Pink
- "Violet", // Violet
- "Orchid", // lavender
- "Lime", // bright green
- "Tan", // Brown
- "Red ",
- "Navy" // orange
- };
-
- // The static method is used as an example to draw the simplest line of two points. The actual project loops accordingly.
- Private void doIt ()
- {
- // Create a line Object
- LineChartMyChart=NewLineChart ();
- // Fill the line color
- MyChart. Line. Color= Color. FromName (myColor [0]);
- MyChart. Fill. Color= Color. FromName (myColor [0]);
- MyChart. LineMarker=NewDiamondLineMarker (8, Color. FromName (myColor [0]), Color. FromName (myColor [0]);
- // Legend
- MyChart. Legend="Line 1";
- // Add the first vertex. Parameter 1 is the name of the x coordinate, and parameter 2 is the value of the y coordinate.
- MyChart. Data. Add (new ChartPoint ("1", float. Parse ("100 ")));
- // Add the second Vertex
- MyChart. Data. Add (new ChartPoint ("2", float. Parse ("200 ")));
- // Chart is the Control ID.
- This. chart. Charts. Add (myChart );
- This. chart. RedrawChart ();
- }
ASP. NET Report controls 2. Bar Chart
- // Color array
- Private string []MyColor=NewString []
- {
- "Fuchsia ",
- "Black ",
- "Gold ",
- "Blue ",
- "HotPink ",
- "Orange ",
- "Peru ",
- "DodgerBlue ",
- "Lime ",
- "Tan ",
- "Red ",
- "GreenYellow ",
- "DarkGreen ",
- "DimGray ",
- "Orchid"
- };
-
- // Call this method to generate a bar chart
- Private void bindchart ()
- {
- // Obtain a DataTable. The specific function is omitted...
- DataTableDt=This. Getdt ();
- If (dt! = Null)
- {
- If (dt. Rows. Count>0)
- {
- // Traverse the DataTable to generate a column for each record
- For (intI=0; I< Dt. Rows. Count; I ++)
- {
- // Create an object
- ColumnChartMychart=NewColumnChart ();
- // Set the column width
- Mychart. MaxColumnWidth=48;
- // Color
- Mychart. Fill. Color= Color. FromName (this. myColor [I]);
- // Display the quantity on the column
- Mychart. DataLabels. Visible=True;
- // Number of fonts
- Mychart. DataLabels. Font=NewFont ("Verdana", 14 );
- // Add
- Mychart. Data. Add (new ChartPoint ("", float. Parse (dt. Rows [I] ["num"]. ToString ())));
- // Remarks
- Mychart. Legend=Dt. Rows [I] ["name"]. ToString ();
- This. chart. Charts. Add (mychart );
- }
- // Auxiliary settings
- // Background color
- Chart. Background. Color= Color. FromArgb (165, 0, 16 );
- Chart. YAxisFont. ForeColor= Color. FromArgb (165, 0, 16 );
- Chart. XAxisFont. ForeColor= Color. FromArgb (165, 0, 16 );
- // Internal line
- Chart. Border. Color= Color. FromArgb (200,200,200 );
- // Border Style
- Chart. BorderStyle= BorderStyle. None;
- // Maximum value of y
- DoubleMax=Double. Parse (dt. Compute ("MAX (num)", ""). ToString ());
- // Increment Value
- IntIntv=2;
-
- // When the number is less than 16
- If (max< 16)
- {
- Max=16;
- }
- // Case larger than 16
- Else
- {
- IntIntv= Int. Parse (Math. Ceiling (max/8). ToString ());
- Max + = intv;
- }
-
- // Set the end value of the Y axis
- Chart. YCustomEnd=Int. Parse (max. ToString ());
- // Y increment Value
- Chart. YValuesInterval=Intv;
-
- // Generate
- This. chart. RedrawChart ();
- }
- }
- }
Web Chart is a free ASP. NET Report control. You can download it from the official address: http://www.carlosag.net/tools/webchart/default.aspx. there are also many effects and code examples.
- Shell functions in ASP. NET Environment
- Batch insert data to databases in ASP. NET
- ASP. NET sends data to webpages in Post Mode
- WEB Application Deployment in ASP. NET 2.0
- HttpWorkerRequest object in ASP. NET
- Eve of the owc component in ASP. NET 2.0