Recently a period of time to write a few reports with MSChart, so just started contact, wrote a few reports on the MSChart has a little summary
1. Property
1.1 Series
char1.legends["Legend" + i]. Legendstyle = legendstyle.column;//Display by column
char1.legends["Legend" + i]. docking = docking.right;//displayed in upper right corner;
Char1.series[seriesname]. BorderWidth = 3;
Node size is 5
Char1.series[seriesname]. Markersize = 7;
Char1.series[seriesname]. Isvisibleinlegend = false;
1.2 Chartareas
Chart1.chartareas[0]. Axisx.interval = 1; Set the x-axis coordinates at an interval of 1
chart1.chartareas[0]. Axisx.intervaloffset = 1; Set the x-axis coordinate offset to 1
chart1.chartareas[0]. AxisX.LabelStyle.IsStaggered = true;
There is a intersection
char1.chartareas["Chartareasvalue" on the y axis. Axisx.ismarginvisible = false;
CHAR1.TITLES.ADD (String. Format ("{0} Years of survey and design production value complete", This.ddlSearchYear.SelectedValue));
char1.chartareas["Chartareasvalue"]. Axisy.title = "unit: Million";
1.3 Charts
Chartdatatablehelper tablehelper = new Chartdatatablehelper ();
Show Total
tablehelper.initialize (char1,false);
2. Binding
2.1
A pillar datarow[] Dtchartdata = dsresult.tables["Dtdeptresult"].
Select ("1=1");
String xvaluemember = "Deptname";
String yvaluemembers = "Allmark";
Chartdeptmark.datasource = Dtchart.defaultview;
CHARTDEPTMARK.SERIES.ADD ("Series1"); chartdeptmark.series["Series1"].
Xvaluemember = Xvaluemember; chartdeptmark.series["Series1"].
Yvaluemembers = yvaluemembers; Multiple columns in one piece of data correspond to more than one Y-value datarow[] Drresult = Getvalueofyear ().
Select ("statyear=100");
for (int i = 0; i < i++) {if (Startmonth > 12) {
Startmonth-= 12;
} Montharr[i] = Startmonth;
String columnName = "CVM" + startmonth; char1.series["Series0"].
POINTS.ADDXY (Startmonth.tostring (), Drresult[0][columnname]); Char1.series["Series0"].
Xvaluemember = Montharr;
startmonth++; //Multiline data for (int i = 0; i < DtResult.Columns.Count i++) {Stri ng columnName = dtresult.columns[i].
ColumnName;
String seriesname = "Series" + i;
CHAR1.SERIES.ADD (seriesname); Char1.series[seriesname].
POINTS.DATABINDXY (Dtresult.defaultview, "Belongtype", Dtresult.defaultview, ColumnName);
}
2.2 Split Pie chart
DataTable Dtresult = GetResult ();
CHAR1.SERIES.ADD ("Serie0");
char1.series["Serie0"]. Points.databind (Dtresult.defaultview, "Belongtype", "Belongtyperatio", "legendtext=" + "Belongtype");
char1.series["Serie0"]. ChartType = (seriescharttype) enum.parse (typeof (Seriescharttype), "Pie", true);
CHAR1.LEGENDS.ADD ("Legend0");
char1.series["Serie0"]. Label = "#LEGENDTEXT: #PERCENT {P}";
char1.series["Serie0" ["pielabelstyle"] = "Outside";
Displays char1.series["Serie0" for no value as a label
. Isvalueshownaslabel = true;
Split Diagram
foreach (DataPoint point in char1.series["Serie0"). Points)
{
point["exploded"] = "true";
}
3. The event
Adds a click event to the graphic in the diagram, which is called the foreground function after the column is clicked, and the Jump detail page
chartdeptmark.series["Series1"]. MapAreaAttributes = "Onclick=\" Javascript:return deptmark (' #VALX ');