Use C # To draw a chart (pie chart line chart ),

Source: Internet
Author: User

Use C # To draw a chart (pie chart line chart ),

Public PlaceHolder PlaceHolder1; // controls for displaying images

The category names of each image are as follows:

PictureType Graphic Type 5 chChartTypeBarClustered clustered bar chart 0 NULL

PictureType Graphic Type 7 chChartTypeBarClustered3D 3D clustered bar chart 0 NULL

PictureType Graphic Type 6 chChartTypeBarStacked Stacked bar chart 0 NULL

PictureType Graphic Type 8 chChartTypeBarStacked3D Stacked bar chart 0 NULL

PictureType Graphic Type 1 chChartTypeColumnClustered clustered column type 0 NULL

PictureType Graphic Type 3 chChartTypeColumnClustered3D 3D clustered column type 0 NULL

PictureType Graphic Type 2 chChartTypeColumnStacked Stacked column Chart 1 NULL

PictureType Graphic Type 4 chChartTypeColumnStacked3D Stacked column limit 0 NULL

PictureType Graphic Type 13 chChartTypeLine line chart 0 NULL

PictureType graph type 15 chChartTypeLineMarkers data point line chart 0 NULL

PictureType Graphic Type 14 chChartTypeLineStacked stacked line chart 0 NULL

PictureType Graphic Type 16 chChartTypeLineStackedMarkers stacked data point line chart 0 NULL

PictureType Graphic Type 17 chChartTypePie pie chart 1 NULL

PictureType Graphic Type 19 chChartTypePie3D 3D pie chart 0 NULL

PictureType graphic type 18 chChartTypePieExploded separated pie chart 0 NULL

PictureType Graphic Type 20 chChartTypePieExploded3D separated 3D pie chart 0 NULL

PictureType Graphic Type 9 chChartTypeSmoothLine smoothing line chart 0 NULL

PictureType Graphic Type 10 chChartTypeSmoothLineMarkers data point smoothing line chart 0 NULL

PictureType Graphic Type 11 chChartTypeSmoothLineStacked stacked smoothing line chart 0 NULL

PictureType Graphic Type 12 chChartTypeSmoothLineStackedMarkers stacked Data Smoothing Line chart 0 NULL

The image retrieval method is as follows:

/// </Summary> /// <param name = "dbDtViewWrk"> transmitted data </param> /// <param name = "strAbsolutePath"> absolute path </ param> /// <param name = "strRelativePath"> relative path </param> /// <param name = "ChartType"> Format of the graph to be drawn (pie chart or line chart)) </param> // <param name = "strTitle"> statistical name </param> public void PaintToImage (DataTable dbDtViewWrk, string strAbsolutePath, string strRelativePath, character ChartType, string strTitle) {string strS EriesName = "legend"; // stores the project string [] ItemsName = new string [dbDtViewWrk. rows. count]; // string [] ItemsCount = new string [dbDtViewWrk. rows. count]; // The unit of scale int iUnit = 1; // The maximum value int iMaxValue = 0; string strXdata = String. empty; string strYdata = String. empty; // assign a value to the array for (int I = 0; I <dbDtViewWrk. rows. count; I ++) {ItemsName [I] = dbDtViewWrk. rows [I] [0]. toString (); // field name to be counted ItemsCount [I] = dbDtVi EwWrk. rows [I] [5]. toString (); // field data to be calculated} // specify a specific string for the X axis to display data // String strXdata = string. empty; foreach (string strData in ItemsName) {strXdata + = strData + "\ t" ;}// string strYdata = String. empty; // specify a specific string for the Y axis to correspond to the X axis in foreach (string strValue in ItemsCount) {strYdata + = strValue + "\ t"; if (int. parse (strValue)> iMaxValue) {iMaxValue = int. parse (strValue) ;}}if (iMaxValue> 20) {iUnit = IMaxValue/10;} // create a ChartSpace object to place the chart ChartSpace laySpace = new ChartSpaceClass (); // Add the chart ChChart InsertChart = laySpace to the ChartSpace object. charts. add (0); // base color InsertChart. plotArea. interior. color = "white"; // specify the chart type. You can use OWC. chartChartTypeEnum enumeration is worth accessing InsertChart. type = ChartType; // column chart // specifies whether the legend is required to indicate InsertChart. hasLegend = true; InsertChart. barWidth = 0; InsertChart. legend. position = ChartLegendPositionEnum. chLegendPositionBottom; InsertChart. hasTitle = true; // Add the title InsertChart for the chart. title. caption = strTitle; // The title name. // if (ChartType. toString (). indexOf ("ChartTypePie") =-1) {InsertChart. axes [0]. font. size = 11; // the X axis of InsertChart. axes [1]. font. size = 11; // y axis InsertChart. legend. font. size = 11; InsertChart. axes [0]. hasTitle = true; InsertChart. axes [0]. title. caption = ""; // InsertChart of the month. axes [1]. hasTitle = true; // InsertChart. axes [1]. scaling. splitMinimum = 200; InsertChart. axes [1]. title. caption = "quantity"; InsertChart. axes [1]. majorUnit = iUnit; // set the scale unit to InsertChart. axes [1]. scaling. minimum = 0; // min scale = 0} // Add Add a series InsertChart. seriesCollection. add (0); // specifies the name of the series, InsertChart. seriesCollection [0]. setData (ChartDimensionsEnum. chDimSeriesNames, + (int) chartspecialperformancesenum. chDataLiteral, strSeriesName); // you can specify strXdata = strXdata. substring (0, strXdata. length-1); InsertChart. seriesCollection [0]. setData (ChartDimensionsEnum. chDimCategories, + (int) chartspecialperformancesenum. chDataLiteral, strX Data); // specify strYdata = strYdata. substring (0, strYdata. length-1); InsertChart. seriesCollection [0]. setData (ChartDimensionsEnum. chDimValues, (int) chartspecialperformancesenum. chDataLiteral, strYdata); // Add the label ChDataLabels dls = InsertChart. seriesCollection [0]. dataLabelsCollection. add (); if (ChartType. toString (). indexOf ("ChartTypePie ")! =-1) {dls. position = ChartDataLabelPositionEnum. chLabelPositionCenter; dls. hasPercentage = false; // dls. hasValue = false; dls. hasCategoryName = false; // specifies whether the legend of the chart needs to be labeled as InsertChart. hasLegend = true; InsertChart. legend. position = ChartLegendPositionEnum. chLegendPositionBottom;} // output file. int iImageLength = 0; int iImageWidth = 0; // get the settings from the Config file // iImageLength = int. parse (WebConfigurationManager. appSettings ["ShowImageLength"]); // iImageWidth = int. parse (WebConfigurationManager. appSettings ["ShowImageWidth"]); iImageLength = 450; iImageWidth = 300; string strImageName = ChartType. toString () + "_" + Guid. newGuid (). toString ("N") + ". png "; laySpace. exportPicture (strAbsolutePath + strImageName, "PNG", 450,300); // Add the image to placeholder, the string strImageTag = "

 


C language ^ how to use

A1 = 0x01; // 0000 0001
A2 = 0x00; // 0000 0000
A3 = 0x03; // 0000 0011
A4 = 0x02; // 0000 0010

B1 = a1 ^ a2; // 0000 0001
B2 = a1 ^ a3; // 0000 0010
B3 = a1 ^ a4; // 0000 0011

^ XOR operator. The bitwise value is 0 and the difference is 1. See the example above.

//
Examples of simple and practical problems:
====================================
======= A ======= B =========
There are two circuits on the top. The two switches are a and B respectively. The opening status is \ [1], and the closing status is/[0].
If both circuits are enabled or disabled.
If a turns on [1], B turns off [0], and circuit 1 Powers on
=====================
If a disables [0], B enables [1], and circuit 2 powers on.
====================================
In summary, the circuit fails in the and B states simultaneously [0]. When a and B are different, the power is charged [1].

How to judge prime numbers using C language

A prime number is a number that cannot be divisible by any integer except 1 and itself. For example, 17 is a prime number because it cannot be 2 ~ Any integer in 16. Therefore, to determine whether an integer m is a prime number, you only need to set m to 2 ~ M-1 no integer can be divisible, m is a prime number.
In addition, the judgment method can be simplified. M does not need to be 2 ~ Remove each integer between the numbers expressed as 1 and 2 ~ √ Remove each integer between m. If m cannot be 2 ~ √ Any integer across m, m must be a prime number. For example, to determine whether 17 is a prime number, you only need to enable 17 to be 2 ~ Since each integer between 4 cannot be divisible, 17 is a prime number. (Cause: If m can be 2 ~ If any integer is divisible between expressed on and off, one of the two factors must be less than or equal to √ m, and the other one must be greater than or equal to √ m. For example, 16 can be divided by 2, 4, 8, 16 = 2*8, 2 less than 4, 8 greater than 4, 16 = 4*4, 4 = √ 16, so only 2 ~ There is no factor between 4)
# Include <stdio. h>
# Include <math. h>
Void main ()
{
Int m, I, k;
Printf ("enter an integer :");
Scanf ("% d", & m );
K = (int) sqrt (m );
For (I = 2; I <= k; I ++)
If (m % I = 0)
Break;
If (I> k)
Printf ("% d is a prime number. \ N ", m );
Else
Printf ("% d is not a prime number. \ N ", m );
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.