First, the construction method Controlchart
1, the foreground page control assigns the value
Time drop-down box assignment, drop-down box assigns selected value
for (int II = DateTime.Today.Year; II >= 1980; ii--)
{
String item = String. Format ("{0} years", Ii. ToString ());
THIS.DATEYEAR.ITEMS.ADD (item);
if (item = = sclickreportdate)
{
This.dateYear.SelectedValue = sclickreportdate;//drop-down box assigns the selected value
}
}
2, page place name drop-down box bound data, drop-down box to assign the selected value
String str = "Daqing, Jilin, Liaohe, Huabei, Dagang, Jidong, Zhejiang, Xinjiang";
string[] address = str. Split (', ');
for (int i = 0; i < address. Length; i++)
{
THIS.ADDRESSNAMELIST.ITEMS.ADD (Address[i]);
if (address[i] = = ChartTitle)
{
This.addressNameList.SelectedValue = charttitle;//drop-down box assigns the selected value
}
}
3. Adjust page layout
This.dateStart.Visibility = visibility.collapsed;//does not display controls
this.dateYear.Visibility = visibility.visible;//Display control
This.addressName.Margin =New Thickness (167, 16, 0, 0);//Location
This.addressNameList.Margin = new Thickness (212, 12, 0, 0);
This.btnDown.Margin = new Thickness (322, 12, 0, 0);
This.dtName.Margin = new Thickness (412, 16, 0, 0);
This.showData.Margin = new Thickness (470, 18, 0, 0);
4. Query method (call WCF to get paint information)
Query ();
private void Query ()
{
Dbserviceclient svc = new Dbserviceclient (); Call the WCF
Commissioned
Svc. getsinglechartdatacompleted + = new Eventhandler<getsinglechartdatacompletedeventargs> (svc_ getsinglechartdatacompleted);
Calling WCF's Getsinglechartdata method
(For more information, please refer to the blog: Silverlight Visifire control chart making--WCF)
Svc. Getsinglechartdataasync (Strreportdate, Strendreportdate, Stnameclick, sxname);
}
5. Printing
(For more information, please refer to the blog: Silverlight Visifire control chart making--silverlight background method print http://www.cnblogs.com/xuxin-1989/p/3819686.html)
6. Delegation method
private void Svc_getsinglechartdatacompleted (object sender, Getsinglechartdatacompletedeventargs e)
{
Get the WCF return value
observablecollection<listitem> Lbaseoilbar = E.result;
Drawing
Createchart (This.gridvisifire, Lbaseoilbar);
}
7, drawing method (please refer to blog: Silverlight Visifire control chart making--silverlight background method drawing method)
8. Page Events
(For more information, please refer to the blog: Silverlight Visifire control chart making--silverlight background Method page event http://www.cnblogs.com/xuxin-1989/p/3819773.html)