Hi Friends,

I have come up with the solution to select Data Source for Trend WebPart programmatically.
It involves editing the xml with following steps:
Step 1) from your Share Point site add PI Trend webpart and modify its shared properties.
Step 2) After Configuring the webpart, you will get a trend webpart which shows you graph for the selected data source after modifying shared properties.
Step 3) Now export the configured webpart into your machine. I will prompt you to save exported file with extension. Save file as <webpart-name>.dwp.
For example:- PI.dwp
Step 4) Open exported file (PI.dwp) in Edit plus (this is an text editor for different type of files). You will get an XML file.
Step 5) Search for "RtWPDataQuery" Tag it is the actual tag which carry the Data Source information.
Note:- while modifying the xml please remove value inside "ClientDataResultKey" tag.
Step 6) Also Modify "TraceElement" tag inside "traceElements" tag. Each Data source of "RtWPDataQuery" has a corresponding "TraceElement".
Step 7) Now you can directly import this modified PI.dwp webpart to sharepoint site OR you can create a webpart which export this PI.dwp as xml and display in sharepoint site.

Hence you will get a PI Trend Webpart added to your share point site programmatically. If any one is having problem please feel free to ask.
Thanks,
Vivek Gupta