// Create an X coordinate value, indicating the month Int [] Month = new int [3] {1, 2, 3 }; // Create the Y coordinate value to indicate the sales volume Double [] Count = new double [3] {120,240,220 }; // Create a chart Space ChartSpace mychartSpace = new ChartSpace (); // Add a chart object to the chart Space ChChart mychart = mychartSpace. Charts. Add (0 ); // Set the chart type. In this example, use a column. Mychart. Type = ChartChartTypeEnum. chChartTypeColumnClustered; // Set chart attributes // Do you need a legend? Mychart. HasLegend = true; // Whether a topic is required Mychart. HasTitle = true; // Subject content Mychart. Title. Caption = "quarterly summary "; // Set the x and y coordinates Mychart. Axes [0]. HasTitle = true; Mychart. Axes [0]. Title. Caption = "month "; Mychart. Axes [1]. HasTitle = true; Mychart. Axes [1]. Title. Caption = "sales volume "; // Add three chart Blocks Mychart. SeriesCollection. Add (0 ); Mychart. SeriesCollection. Add (0 ); Mychart. SeriesCollection. Add (0 ); // Set chart block attributes // Title Mychart. SeriesCollection [0]. Caption = "August "; // Value Attribute of X coordinate Mychart. SeriesCollection [0]. SetData (ChartDimensionsEnum. chDimCategories, (Int) chartspecialperformancesenum. chDataLiteral, Month [0]); // Value Attribute of y coordinate Mychart. SeriesCollection [0]. SetData (ChartDimensionsEnum. chDimValues, (Int) chartspecialperformancesenum. chDataLiteral, Count [0]); // The second block Mychart. SeriesCollection [1]. Caption = "August "; // Value Attribute of X coordinate Mychart. SeriesCollection [1]. SetData (ChartDimensionsEnum. chDimCategories, (Int) chartspecialperformancesenum. chDataLiteral, Month [1]); // Value Attribute of y coordinate Mychart. SeriesCollection [1]. SetData (ChartDimensionsEnum. chDimValues, (Int) chartspecialperformancesenum. chDataLiteral, Count [1]); // The third block Mychart. SeriesCollection [2]. Caption = "August "; // Value Attribute of X coordinate Mychart. SeriesCollection [2]. SetData (ChartDimensionsEnum. chDimCategories, (Int) chartspecialperformancesenum. chDataLiteral, Month [2]); // Value Attribute of y coordinate Mychart. SeriesCollection [2]. SetData (ChartDimensionsEnum. chDimValues, (Int) chartspecialperformancesenum. chDataLiteral, Count [2]); // Generate an image MychartSpace. ExportPicture (Server. MapPath (".") + @ "\ test.jpg", "jpg", 500,450 ); // Load the image Image1.ImageUrl = Server. MapPath (".") + @ "\ test.jpg "; } |