Charting code import

This commit is contained in:
2015-11-20 11:46:43 -05:00
parent efcff634a5
commit 5aaed082c9
7 changed files with 1859 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
using System;
using System.IO;
namespace LeafWeb.Web.Charter
{
[Serializable]
public class CurveData
{
private readonly String curveID;
private readonly CurveParamSet paramSet1;
private readonly CurveParamSet paramSet2;
private readonly CurveParamSet paramSet3;
private readonly CurveParamSet paramSet4;
public CurveData()
{
}
public CurveData(StreamReader sr, ref String errMsg, ref int lineNbr)
{
// For each curve in the output file there are four sets of data.
paramSet1 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID);
if (errMsg.Length > 0)
return;
paramSet2 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID);
if (errMsg.Length > 0)
return;
paramSet3 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID);
if (errMsg.Length > 0)
return;
paramSet4 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref curveID);
if (errMsg.Length > 0)
return;
return;
}
public String getCurveID()
{
return curveID;
}
public CurveParamSet getParamSet1()
{
return paramSet1;
}
public CurveParamSet getParamSet2()
{
return paramSet2;
}
public CurveParamSet getParamSet3()
{
return paramSet3;
}
public CurveParamSet getParamSet4()
{
return paramSet4;
}
}
}
+248
View File
@@ -0,0 +1,248 @@
using System;
using System.Collections;
using System.IO;
using System.Text;
namespace LeafWeb.Web.Charter
{
[Serializable]
public class CurveParamSet
{
private readonly ArrayList anetMeasChloro1Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=1
private readonly ArrayList anetMeasChloro2Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=2
private readonly ArrayList anetMeasChloro3Data; // y=AnetMeas column, x=PCO2c, for PointLimitType=3
private readonly ArrayList anetMeasInter1Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=1
private readonly ArrayList anetMeasInter2Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=2
private readonly ArrayList anetMeasInter3Data; // y=AnetMeas column, x=PCO2i, for PointLimitType=3
private readonly ArrayList acChloroData; // y=Ac column, x=CO2cc column
private readonly ArrayList ajChloroData; // y=Aj column, x=CO2cj column
private readonly ArrayList atChloroData; // y=At column, x=CO2ct column
private readonly ArrayList acInterData; // y=Ac column, x=CO2i column
private readonly ArrayList ajInterData; // y=Aj column, x=CO2i column
private readonly ArrayList atInterData; // y=At column, x=CO2i column
public CurveParamSet()
{
}
public CurveParamSet(StreamReader sr, ref String errMsg, ref int lineNbr, ref String curveID)
{
bool curveIDSet = false, doneWithAnet = false;
String line, firstField;
var errorMsg = new StringBuilder("");
ArrayList phrases;
XYPoint xyPoint1, xyPoint2;
int pointLimitType;
anetMeasChloro1Data = new ArrayList();
anetMeasChloro2Data = new ArrayList();
anetMeasChloro3Data = new ArrayList();
anetMeasInter1Data = new ArrayList();
anetMeasInter2Data = new ArrayList();
anetMeasInter3Data = new ArrayList();
acChloroData = new ArrayList();
ajChloroData = new ArrayList();
atChloroData = new ArrayList();
acInterData = new ArrayList();
ajInterData = new ArrayList();
atInterData = new ArrayList();
while (!doneWithAnet)
{
lineNbr++;
line = sr.ReadLine();
if (line == null)
{
errorMsg.Append("Unexpected end-of-file at line " + lineNbr);
sr.Close();
errMsg = errorMsg.ToString();
return;
}
phrases = splitCSVLine(line);
firstField = (String) phrases[0];
if (firstField.Equals("CO2i"))
{
doneWithAnet = true;
}
else
{
// The fields on the line:
// Column Name
// 0 CurveID
// 1 ChlFlUse
// 2 FitGi
// 3 FitGamma
// 4 FitKco
// 5 FitRd
// 6 FitAlpha
// 7 LimitCombina
// 8 PCO2i
// 9 PCO2c
// 10 AnetMeas
// 11 AnetCal
// 12 weitedrms
// 13 PointLimitType
if (!curveIDSet)
{
curveID = firstField;
curveIDSet = true;
}
xyPoint1 = new XYPoint((String) phrases[9], (String) phrases[10]); // AnetMeas(y), PCO2c(x)
xyPoint2 = new XYPoint((String) phrases[8], (String) phrases[10]); // AnetMeas(y), PCO2i(x)
pointLimitType = Int32.Parse((String) phrases[13]);
switch (pointLimitType)
{
case 1:
anetMeasChloro1Data.Add(xyPoint1);
anetMeasInter1Data.Add(xyPoint2);
break;
case 2:
anetMeasChloro2Data.Add(xyPoint1);
anetMeasInter2Data.Add(xyPoint2);
break;
case 3:
anetMeasChloro3Data.Add(xyPoint1);
anetMeasInter3Data.Add(xyPoint2);
break;
}
}
}
// The next set of lines will have three pairs of x,y-coordinates to save.
// A blank line signals the end of the data.
var moreData = true;
while (moreData)
{
// The fields on the line:
// Column Name
// 0 CO2i
// 1 CO2cc
// 2 Ac
// 3 CO2cj
// 4 Aj
// 5 CO2ct
// 6 At
lineNbr++;
line = sr.ReadLine();
if (line == null)
{
errorMsg.Append("Unexpected end-of-file at line " + lineNbr);
sr.Close();
errMsg = errorMsg.ToString();
return;
}
if (line.Length == 0)
moreData = false;
else
{
phrases = splitCSVLine(line);
xyPoint1 = new XYPoint((String) phrases[1], (String) phrases[2]); // Ac(y),CO2cc(x)
if (xyPoint1.yIsInRange(-20.0, 50.0))
acChloroData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[3], (String) phrases[4]); // Aj(y),CO2cj(x)
if (xyPoint1.yIsInRange(-20.0, 50.0))
ajChloroData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[5], (String) phrases[6]); // At(y),CO2ct(x)
if (xyPoint1.yIsInRange(-20.0, 50.0))
atChloroData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[2]); // Ac(y),CO2i(x)
if (xyPoint1.yIsInRange(-20.0, 50.0))
acInterData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[4]); // Aj(y),CO2i(x)
if (xyPoint1.yIsInRange(-20.0, 50.0))
ajInterData.Add(xyPoint1);
xyPoint1 = new XYPoint((String) phrases[0], (String) phrases[6]); // At(y),CO2i(x)
if (xyPoint1.yIsInRange(-20.0, 50.0))
atInterData.Add(xyPoint1);
}
}
return;
}
/// <summary>
/// This method assumes that the argument is a comma-, blank-, or
/// tab-separated set of strings. It returns an ArrayList of those
/// quantities. Consecutive commas will be returned as an empty string,
/// but all empty strings at the end of the line will be thrown away.
/// </summary>
/// <param name="line"></param>
/// <returns></returns>
private ArrayList splitCSVLine(String line)
{
int i;
char[] separator;
separator = new char[3];
separator[0] = ',';
separator[1] = ' ';
separator[2] = '\t';
var phrases = line.Split(separator);
String phrase;
//int lastNonBlank = -1;
var retPhrases = new ArrayList();
for (i = 0; i < phrases.Length; i++)
{
phrase = phrases[i].Trim();
if (phrase.Length > 0)
// lastNonBlank = i;
retPhrases.Add(phrase);
}
//int firstBlankToRemove = lastNonBlank + 1;
//if( firstBlankToRemove <= phrases.Length - 1 )
// retPhrases.RemoveRange(firstBlankToRemove, phrases.Length - firstBlankToRemove);
return retPhrases;
}
public ArrayList getAnetMeasData()
{
var list = new ArrayList();
list.Add(anetMeasChloro1Data);
list.Add(anetMeasChloro2Data);
list.Add(anetMeasChloro3Data);
list.Add(anetMeasInter1Data);
list.Add(anetMeasInter2Data);
list.Add(anetMeasInter3Data);
return list;
}
public ArrayList getAcChloroData()
{
return acChloroData;
}
public ArrayList getAjChloroData()
{
return ajChloroData;
}
public ArrayList getAtChloroData()
{
return atChloroData;
}
public ArrayList getAcInterData()
{
return acInterData;
}
public ArrayList getAjInterData()
{
return ajInterData;
}
public ArrayList getAtInterData()
{
return atInterData;
}
}
}
+529
View File
@@ -0,0 +1,529 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LeafWebCharter.ascx.cs" Inherits="LeafWeb.Web.Charter.LeafWebCharter" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<asp:Label ID="ErrorLBL" runat="server" Text="" ForeColor="Red" Font-Bold="true"></asp:Label>
<br />
<h1>Charting the Output from LeafWeb Jobs</h1>
<asp:Panel ID="JobChoosePNL" runat="server">
<asp:Label ID="ChooseJobErrrorLBL" runat="server" Text="" ForeColor="Red" Font-Bold="true"></asp:Label>
<br /><br />
Choose a LeafWeb job:
<asp:GridView ID="JobGV" runat="server" AutoGenerateColumns = "False"
Font-Size="Small" Width="500px" BorderStyle="Groove"
BorderWidth="10px" GridLines="Both" AlternatingRowStyle-BackColor="LightGray"
BorderColor="Transparent" >
<HeaderStyle Font-Size="Medium" BackColor="LightGray" />
<Columns>
<asp:CommandField />
<asp:TemplateField HeaderText="Name" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:LinkButton ID="NameLB" runat="server" Text='<%# Eval("name") %>'
CommandArgument='<%# Eval("name") %>'
OnClick="ChooseJob" >
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Submitted by" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label ID="SubmittedByLBL" runat="server"
Text='<%# Eval("submittedBy") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Identifier" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label ID="IdentifierLBL" runat="server"
Text='<%# Eval("identifier") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date finished" HeaderStyle-HorizontalAlign="Left" >
<ItemTemplate>
<asp:Label ID="DateSubmittedLBL" runat="server"
Text='<%# Eval("dateSubmitted") %>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="LightGray" />
</asp:GridView>
</asp:Panel>
<asp:Panel ID="CurveChoosePNL" runat="server">
<table>
<tr>
<td><b>Job number:</b></td>
<td>
<asp:Label ID="JobNumberLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td><b>Submitted by:</b></td>
<td>
<asp:Label ID="SubmittedByLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td><b>Job name:</b></td>
<td>
<asp:Label ID="JobNameLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td><b>Date job finished:</b></td>
<td>
<asp:Label ID="JobDoneDateLBL" runat="server" Text=""></asp:Label>
</td>
</tr>
</table>
<br /><br />
<asp:Button ID="BackToJobListBTN" runat="server" Text="Back to job list"
OnClick="BackToJobList" />
<br /><br />
Please choose one of the curves to chart.<br />
<asp:DropDownList ID="CurveDDL" runat="server">
</asp:DropDownList>
<asp:Button ID="ProduceChartBTN" runat="server" Text="Produce Chart"
onclick="ProduceChartBTN_Click" />
</asp:Panel>
<br /><br />
<asp:Panel ID="ChartPNL" runat="server">
<asp:Chart ID="ChartChloro1" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Chloroplastic CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartChloro2" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Chloroplastic CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartChloro3" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Chloroplastic CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartChloro4" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Chloroplastic CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartInter1" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Intercellular CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartInter2" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Intercellular CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartInter3" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Intercellular CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:Chart ID="ChartInter4" runat="server" Width="700" Height="500" >
<legends>
<asp:Legend Enabled="True" IsTextAutoFit="False" Name="Default" Docking="Bottom"
BackColor="Transparent" Font="Trebuchet MS, 12pt, style=Bold"></asp:Legend>
</legends>
<borderskin SkinStyle="Emboss"></borderskin>
<series>
<asp:Series MarkerSize="8" BorderWidth="3" XValueType="Double"
Name="Rubisco-limited" ChartType="Point" MarkerStyle="Diamond"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="9" BorderWidth="3" XValueType="Double"
Name="RuBP regeneration-limited" ChartType="Point" MarkerStyle="Circle"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="acCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Red" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="ajCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Blue" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
<asp:Series MarkerSize="2" BorderWidth="1" XValueType="Double"
Name="atCurve" ChartType="Line" MarkerStyle="None"
ShadowColor="Black" BorderColor="180, 26, 59, 105"
Color="Orange" ShadowOffset="0" IsVisibleInLegend="false"
YValueType="Double"></asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1" BorderColor="64, 64, 64, 64"
BorderDashStyle="Solid" BackSecondaryColor="White"
BackColor="OldLace" ShadowColor="Transparent"
BackGradientStyle="TopBottom" >
<area3dstyle Rotation="25" Perspective="9" LightStyle="Realistic"
Inclination="40" IsRightAngleAxes="False" WallWidth="3"
IsClustered="False" />
<axisy LineColor="64, 64, 64, 64" Title="Net assimilation rate (umol/m2/s)" >
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisy>
<axisx LineColor="64, 64, 64, 64"
Minimum="0" Title="Intercellular CO2 partial pressure (Pa)">
<LabelStyle Font="Trebuchet MS, 12pt, style=Bold" />
<MajorGrid LineColor="64, 64, 64, 64" />
</axisx>
</asp:ChartArea>
</chartareas>
</asp:Chart>
</asp:Panel>
+682
View File
@@ -0,0 +1,682 @@
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace LeafWeb.Web.Charter
{
public partial class LeafWebCharter : UserControl
{
private static String hostname = "http://leafweb.ornl.gov";
//static String hostname = "http://bjerkevpc/leaf";
protected void Page_Load(object sender, EventArgs e)
{
//WriteTrace("Got to Page_Load");
SPFolderCollection subFolders = null;
if (! IsPostBack)
{
try
{
var siteCollection = new SPSite(hostname);
// WriteTrace("Got siteCollection");
if (siteCollection == null)
{
WriteTrace("siteCollection is null");
ErrorLBL.Text = "siteCollection is null";
ErrorLBL.Visible = true;
return;
}
SPWeb webSite = siteCollection.OpenWeb();
//WriteTrace("Got webSite");
if (webSite == null)
{
WriteTrace("webSite is null");
ErrorLBL.Text = "webSite is null";
ErrorLBL.Visible = true;
return;
}
SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles");
//WriteTrace("Got lofFolder");
if (lofFolder == null)
{
WriteTrace("lofFolder is null");
ErrorLBL.Text = "lofFolder is null";
ErrorLBL.Visible = true;
return;
}
subFolders = lofFolder.SubFolders;
//WriteTrace("Got subFolders");
if (subFolders == null)
{
WriteTrace("subFolders is null");
ErrorLBL.Text = "subFolders is null";
ErrorLBL.Visible = true;
return;
}
}
catch (Exception exc)
{
ErrorLBL.Text = "Error locating folder: " + exc.Message;
ErrorLBL.Visible = true;
return;
}
//WriteTrace("# subfoldrs = " + subFolders.Count);
String folderName, identifier, submittedBy;
DateTime dateSubmitted;
int intName;
String propertyKey;
Object propertyValue;
String dateTimeCreated;
var dt = new DataTable();
dt.Columns.Add(new DataColumn("name"));
dt.Columns.Add(new DataColumn("submittedBy"));
dt.Columns.Add(new DataColumn("identifier"));
dt.Columns.Add(new DataColumn("dateSubmitted"));
var dcIntName = new DataColumn("intName");
dcIntName.DataType = Type.GetType("System.Int32");
dt.Columns.Add(dcIntName);
//WriteTrace("DataTable initialized");
DataRow dr;
object obj;
try
{
foreach (SPFolder f in subFolders)
{
folderName = f.Name;
//WriteTrace("folder name = " + folderName);
try
{
intName = Int32.Parse(folderName);
}
catch (Exception exc)
{
//WriteTrace("That is not a job folder");
continue;
}
dr = dt.NewRow();
dr["name"] = folderName;
dr["intName"] = intName;
/*System.Collections.Hashtable pc = f.Properties;
IDictionaryEnumerator myEnumerator = pc.GetEnumerator();
while (myEnumerator.MoveNext())
{
propertyKey = (String) myEnumerator.Key;
propertyValue = myEnumerator.Value;
}*/
identifier = (String) f.Properties["Identifier"];
submittedBy = (String) f.Properties["Submitted by"];
//WriteTrace("identifier=" + identifier + ", submitted by=" + submittedBy);
dateTimeCreated = "";
obj = f.Properties["vti_timecreated"];
if (obj != null)
{
dateSubmitted = (DateTime) obj;
dateSubmitted = dateSubmitted.AddHours(-5);
dateTimeCreated = dateSubmitted.ToShortDateString() +
" " + dateSubmitted.ToShortTimeString();
}
//WriteTrace("date=" + dateTimeCreated);
dr["submittedBy"] = submittedBy;
dr["identifier"] = identifier;
dr["dateSubmitted"] = dateTimeCreated;
dt.Rows.Add(dr);
}
}
catch (Exception exc1)
{
WriteTrace("error browsing folder: " + exc1.Message);
ErrorLBL.Text = "Error browsing folder: " + encodeSqlQuotes(exc1.Message);
ErrorLBL.Visible = true;
return;
}
// The table just created is not sorted. It can be sorted on the intName
// column by referencing its DefaultView.
try
{
var dsSorted = new DataSet();
dt.DefaultView.Sort = "intName ASC";
// Add sorted table to dataset, then bind to control.
// NOTE the use of ToTable to produce a datatable from our sorted view.
dsSorted.Tables.Add(dt.DefaultView.ToTable());
//WriteTrace("dsSorted is ready");
JobGV.DataSource = dsSorted;
JobGV.DataBind();
//WriteTrace("GridView is Bound");
ChooseJobErrrorLBL.Visible = false;
//WriteTrace("ChooseJobErrrorLBL control made visible");
CurveChoosePNL.Visible = false;
//WriteTrace("CurveChoosePNL control made visible");
ChartPNL.Visible = false;
//WriteTrace("ChartPNL control made visible");
}
catch (Exception exc2)
{
WriteTrace("Error: " + exc2.Message);
}
}
}
protected void ChooseJob(object sender, EventArgs e)
{
Session["LeafChartData"] = null;
var lb = (LinkButton) sender;
var jobID = lb.CommandArgument;
var siteCollection = new SPSite(hostname);
SPWeb webSite = siteCollection.OpenWeb();
SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles");
SPFolder jobFolder = lofFolder.SubFolders[jobID];
SPFileCollection fileSet = jobFolder.Files;
var jobName = "";
var submittedBy = "";
jobName = (String) jobFolder.Properties["Identifier"];
submittedBy = (String) jobFolder.Properties["Submitted by"];
var dateTimeCreated = "";
object obj = jobFolder.Properties["vti_timecreated"];
if (obj != null)
{
var dateSubmitted = (DateTime) obj;
dateSubmitted = dateSubmitted.AddHours(-5);
dateTimeCreated = dateSubmitted.ToShortDateString() +
" " + dateSubmitted.ToShortTimeString();
}
var foundFile = false;
if (fileSet != null)
{
foreach (SPFile aFile in fileSet)
{
if (aFile.Name.Contains("cntrlcomparison"))
{
var sr = new StreamReader(aFile.OpenBinaryStream());
var errorMessage = "";
ReadFile(sr, ref errorMessage);
sr.Close();
foundFile = true;
break;
}
}
}
if (!foundFile)
{
ChooseJobErrrorLBL.Text = "That folder does not contain a file called cntrlcomparison.";
ChooseJobErrrorLBL.Visible = true;
return;
}
CurveChoosePNL.Visible = true;
JobChoosePNL.Visible = false;
JobNumberLBL.Text = jobID;
SubmittedByLBL.Text = submittedBy;
JobNameLBL.Text = jobName;
JobDoneDateLBL.Text = dateTimeCreated;
}
protected void ReadFile(StreamReader sr, ref String errMsg)
{
var pisOut = new PiscalOutput();
if (!pisOut.readFromStream(sr, ref errMsg))
{
ErrorLBL.Text = errMsg;
ErrorLBL.Visible = true;
return;
}
Session["LeafChartData"] = pisOut;
var aCopy = (PiscalOutput) Session["LeafChartData"];
// The data was successfully read from the file. We must now
// display the curveIDs from the file and prompt the user to pick
// one of them for charting.
var curveDT = new DataTable();
curveDT.Columns.Add(new DataColumn("curveID"));
DataRow dr;
CurveData aCurve;
var curveData = pisOut.getCurveData();
for (var i = 0; i < curveData.Count; i++)
{
aCurve = (CurveData) curveData[i];
dr = curveDT.NewRow();
dr["curveID"] = aCurve.getCurveID();
curveDT.Rows.Add(dr);
}
CurveDDL.DataSource = curveDT;
CurveDDL.DataTextField = "curveID";
CurveDDL.DataValueField = "curveID";
CurveDDL.DataBind();
}
protected void ProduceChartBTN_Click(object sender, EventArgs e)
{
ChartPNL.Visible = true;
var pisOut = (PiscalOutput) Session["LeafChartData"];
// If the session has timed out, use the selected index from the GridView
// to determine which job to chart.
if (pisOut == null)
{
var selectedIndex = JobGV.SelectedIndex;
var gvr = JobGV.Rows[selectedIndex];
var nameLB = (LinkButton) gvr.FindControl("NameLB");
var jobID = nameLB.Text;
var siteCollection = new SPSite(hostname);
SPWeb webSite = siteCollection.OpenWeb();
SPFolder lofFolder = webSite.GetFolder("LeafOutputFiles");
SPFolder jobFolder = lofFolder.SubFolders[jobID];
SPFileCollection fileSet = jobFolder.Files;
if (fileSet != null)
{
foreach (SPFile aFile in fileSet)
{
if (aFile.Name.Contains("cntrlcomparison"))
{
var sr = new StreamReader(aFile.OpenBinaryStream());
var errorMessage = "";
ReadFile(sr, ref errorMessage);
sr.Close();
break;
}
}
}
pisOut = (PiscalOutput) Session["LeafChartData"];
}
var curveData = pisOut.getCurveData();
var curve = (CurveData) curveData[CurveDDL.SelectedIndex];
var curveID = curve.getCurveID();
CurveParamSet paramSet1 = null;
CurveParamSet paramSet2 = null;
CurveParamSet paramSet3 = null;
CurveParamSet paramSet4 = null;
paramSet1 = curve.getParamSet1();
paramSet2 = curve.getParamSet2();
paramSet3 = curve.getParamSet3();
paramSet4 = curve.getParamSet4();
var paramSet1Anet = paramSet1.getAnetMeasData();
var paramSet2Anet = paramSet2.getAnetMeasData();
var paramSet3Anet = paramSet3.getAnetMeasData();
var paramSet4Anet = paramSet4.getAnetMeasData();
var anetMeasChloro1PS1Data = (ArrayList) paramSet1Anet[0];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasChloro2PS1Data = (ArrayList) paramSet1Anet[1]; //.getAnetMeasData(2);
var anetMeasChloro3PS1Data = (ArrayList) paramSet1Anet[2]; //.getAnetMeasData(3);
var anetMeasChloro1PS2Data = (ArrayList) paramSet2Anet[0];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasChloro2PS2Data = (ArrayList) paramSet2Anet[1]; //.getAnetMeasData(2);
var anetMeasChloro3PS2Data = (ArrayList) paramSet2Anet[2]; //.getAnetMeasData(3);
var anetMeasChloro1PS3Data = (ArrayList) paramSet3Anet[0];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasChloro2PS3Data = (ArrayList) paramSet3Anet[1]; //.getAnetMeasData(2);
var anetMeasChloro3PS3Data = (ArrayList) paramSet3Anet[2]; //.getAnetMeasData(3);
var anetMeasChloro1PS4Data = (ArrayList) paramSet4Anet[0];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasChloro2PS4Data = (ArrayList) paramSet4Anet[1]; //.getAnetMeasData(2);
var anetMeasChloro3PS4Data = (ArrayList) paramSet4Anet[2]; //.getAnetMeasData(3);
var anetMeasInter1PS1Data = (ArrayList) paramSet1Anet[3];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasInter2PS1Data = (ArrayList) paramSet1Anet[4]; //.getAnetMeasData(2);
var anetMeasInter3PS1Data = (ArrayList) paramSet1Anet[5]; //.getAnetMeasData(3);
var anetMeasInter1PS2Data = (ArrayList) paramSet2Anet[3];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasInter2PS2Data = (ArrayList) paramSet2Anet[4]; //.getAnetMeasData(2);
var anetMeasInter3PS2Data = (ArrayList) paramSet2Anet[5]; //.getAnetMeasData(3);
var anetMeasInter1PS3Data = (ArrayList) paramSet3Anet[3];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasInter2PS3Data = (ArrayList) paramSet3Anet[4]; //.getAnetMeasData(2);
var anetMeasInter3PS3Data = (ArrayList) paramSet3Anet[5]; //.getAnetMeasData(3);
var anetMeasInter1PS4Data = (ArrayList) paramSet4Anet[3];
//.getAnetMeasData(1); // These are arrays of XYPoint objects
var anetMeasInter2PS4Data = (ArrayList) paramSet4Anet[4]; //.getAnetMeasData(2);
var anetMeasInter3PS4Data = (ArrayList) paramSet4Anet[5]; //.getAnetMeasData(3);
XYPoint xy;
int i;
double maxX1 = 0.0,
maxX2 = 0.0,
maxX3 = 0.0,
maxX4 = 0.0,
maxX5 = 0.0,
maxX6 = 0.0,
maxX7 = 0.0,
maxX8 = 0.0;
// Set the points for the symbol series for paramater set 1, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS1Data, ChartChloro1.Series["Rubisco-limited"], ref maxX1);
setAnetMeasPoints(anetMeasChloro2PS1Data, ChartChloro1.Series["RuBP regeneration-limited"], ref maxX1);
var tpuSeries = newTPUSeries(anetMeasChloro3PS1Data);
setAnetMeasPoints(anetMeasChloro3PS1Data, tpuSeries, ref maxX1);
ChartChloro1.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 2, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS2Data, ChartChloro2.Series["Rubisco-limited"], ref maxX2);
setAnetMeasPoints(anetMeasChloro2PS2Data, ChartChloro2.Series["RuBP regeneration-limited"], ref maxX2);
tpuSeries = newTPUSeries(anetMeasChloro3PS2Data);
setAnetMeasPoints(anetMeasChloro3PS2Data, tpuSeries, ref maxX2);
ChartChloro2.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 3, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS3Data, ChartChloro3.Series["Rubisco-limited"], ref maxX3);
setAnetMeasPoints(anetMeasChloro2PS3Data, ChartChloro3.Series["RuBP regeneration-limited"], ref maxX3);
tpuSeries = newTPUSeries(anetMeasChloro3PS3Data);
setAnetMeasPoints(anetMeasChloro3PS3Data, tpuSeries, ref maxX3);
ChartChloro3.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 4, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS4Data, ChartChloro4.Series["Rubisco-limited"], ref maxX4);
setAnetMeasPoints(anetMeasChloro2PS4Data, ChartChloro4.Series["RuBP regeneration-limited"], ref maxX4);
tpuSeries = newTPUSeries(anetMeasChloro3PS4Data);
setAnetMeasPoints(anetMeasChloro3PS4Data, tpuSeries, ref maxX4);
ChartChloro4.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 1, intercellular
setAnetMeasPoints(anetMeasInter1PS1Data, ChartInter1.Series["Rubisco-limited"], ref maxX5);
setAnetMeasPoints(anetMeasInter2PS1Data, ChartInter1.Series["RuBP regeneration-limited"], ref maxX5);
tpuSeries = newTPUSeries(anetMeasInter3PS1Data);
setAnetMeasPoints(anetMeasInter3PS1Data, tpuSeries, ref maxX5);
ChartInter1.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 2, intercellular
setAnetMeasPoints(anetMeasInter1PS2Data, ChartInter2.Series["Rubisco-limited"], ref maxX6);
setAnetMeasPoints(anetMeasInter2PS2Data, ChartInter2.Series["RuBP regeneration-limited"], ref maxX6);
tpuSeries = newTPUSeries(anetMeasInter3PS2Data);
setAnetMeasPoints(anetMeasInter3PS2Data, tpuSeries, ref maxX6);
ChartInter2.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 3, intercellular
setAnetMeasPoints(anetMeasInter1PS3Data, ChartInter3.Series["Rubisco-limited"], ref maxX7);
setAnetMeasPoints(anetMeasInter2PS3Data, ChartInter3.Series["RuBP regeneration-limited"], ref maxX7);
tpuSeries = newTPUSeries(anetMeasInter3PS3Data);
setAnetMeasPoints(anetMeasInter3PS3Data, tpuSeries, ref maxX7);
ChartInter3.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 4, intercellular
setAnetMeasPoints(anetMeasInter1PS4Data, ChartInter4.Series["Rubisco-limited"], ref maxX8);
setAnetMeasPoints(anetMeasInter2PS4Data, ChartInter4.Series["RuBP regeneration-limited"], ref maxX8);
tpuSeries = newTPUSeries(anetMeasInter3PS4Data);
setAnetMeasPoints(anetMeasInter3PS4Data, tpuSeries, ref maxX8);
ChartInter4.Series.Add(tpuSeries);
var acChloroListPS1 = paramSet1.getAcChloroData();
var ajChloroListPS1 = paramSet1.getAjChloroData();
var atChloroListPS1 = paramSet1.getAtChloroData();
var acChloroListPS2 = paramSet2.getAcChloroData();
var ajChloroListPS2 = paramSet2.getAjChloroData();
var atChloroListPS2 = paramSet2.getAtChloroData();
var acChloroListPS3 = paramSet3.getAcChloroData();
var ajChloroListPS3 = paramSet3.getAjChloroData();
var atChloroListPS3 = paramSet3.getAtChloroData();
var acChloroListPS4 = paramSet4.getAcChloroData();
var ajChloroListPS4 = paramSet4.getAjChloroData();
var atChloroListPS4 = paramSet4.getAtChloroData();
var acInterListPS1 = paramSet1.getAcInterData();
var ajInterListPS1 = paramSet1.getAjInterData();
var atInterListPS1 = paramSet1.getAtInterData();
var acInterListPS2 = paramSet2.getAcInterData();
var ajInterListPS2 = paramSet2.getAjInterData();
var atInterListPS2 = paramSet2.getAtInterData();
var acInterListPS3 = paramSet3.getAcInterData();
var ajInterListPS3 = paramSet3.getAjInterData();
var atInterListPS3 = paramSet3.getAtInterData();
var acInterListPS4 = paramSet4.getAcInterData();
var ajInterListPS4 = paramSet4.getAjInterData();
var atInterListPS4 = paramSet4.getAtInterData();
// Set the points on the asymptote curve for parameter set 1, chloroplast
setAsymptotePoints(acChloroListPS1, ChartChloro1.Series["acCurve"], ref maxX1);
setAsymptotePoints(ajChloroListPS1, ChartChloro1.Series["ajCurve"], ref maxX1);
setAsymptotePoints(atChloroListPS1, ChartChloro1.Series["atCurve"], ref maxX1);
// Set the points on the asymptote curve for parameter set 2, chloroplast
setAsymptotePoints(acChloroListPS2, ChartChloro2.Series["acCurve"], ref maxX2);
setAsymptotePoints(ajChloroListPS2, ChartChloro2.Series["ajCurve"], ref maxX2);
setAsymptotePoints(atChloroListPS2, ChartChloro2.Series["atCurve"], ref maxX2);
// Set the points on the asymptote curve for parameter set 3, chloroplast
setAsymptotePoints(acChloroListPS3, ChartChloro3.Series["acCurve"], ref maxX3);
setAsymptotePoints(ajChloroListPS3, ChartChloro3.Series["ajCurve"], ref maxX3);
setAsymptotePoints(atChloroListPS3, ChartChloro3.Series["atCurve"], ref maxX3);
// Set the points on the asymptote curve for parameter set 4, chloroplast
setAsymptotePoints(acChloroListPS4, ChartChloro4.Series["acCurve"], ref maxX4);
setAsymptotePoints(ajChloroListPS4, ChartChloro4.Series["ajCurve"], ref maxX4);
setAsymptotePoints(atChloroListPS4, ChartChloro4.Series["atCurve"], ref maxX4);
// Set the points on the asymptote curve for parameter set 1, intercellular
setAsymptotePoints(acInterListPS1, ChartInter1.Series["acCurve"], ref maxX5);
setAsymptotePoints(ajInterListPS1, ChartInter1.Series["ajCurve"], ref maxX5);
setAsymptotePoints(atInterListPS1, ChartInter1.Series["atCurve"], ref maxX5);
// Set the points on the asymptote curve for parameter set 2, intercellular
setAsymptotePoints(acInterListPS2, ChartInter2.Series["acCurve"], ref maxX6);
setAsymptotePoints(ajInterListPS2, ChartInter2.Series["ajCurve"], ref maxX6);
setAsymptotePoints(atInterListPS2, ChartInter2.Series["atCurve"], ref maxX6);
// Set the points on the asymptote curve for parameter set 3, intercellular
setAsymptotePoints(acInterListPS3, ChartInter3.Series["acCurve"], ref maxX7);
setAsymptotePoints(ajInterListPS3, ChartInter3.Series["ajCurve"], ref maxX7);
setAsymptotePoints(atInterListPS3, ChartInter3.Series["atCurve"], ref maxX7);
// Set the points on the asymptote curve for parameter set 4, intercellular
setAsymptotePoints(acInterListPS4, ChartInter4.Series["acCurve"], ref maxX8);
setAsymptotePoints(ajInterListPS4, ChartInter4.Series["ajCurve"], ref maxX8);
setAsymptotePoints(atInterListPS4, ChartInter4.Series["atCurve"], ref maxX8);
// Now, set the minimum and maximum values for the X-axis. The
// Y-axis seems to be doing OK in auto mode.
//Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = 0;
//Chart1.ChartAreas["ChartArea1"].AxisX.Maximum =
// ((int)(maxX / 10) + 1) * 10;
//Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 10;
var axisFont = new Font("Times New Roman", 12, FontStyle.Bold);
var titleFont = new Font("Times New Roman", 12, FontStyle.Bold);
var titlePS1 = new Title("LeafWeb curveID = " + curveID +
"\nInternal conductance fixed, compensation point and M-M constants fixed");
titlePS1.Font = titleFont;
ChartChloro1.Titles.Add(titlePS1);
ChartInter1.Titles.Add(titlePS1);
var titlePS2 = new Title("LeafWeb curveID = " + curveID +
"\nInternal conductance fixed, compensation point and M-M constants estimated");
titlePS2.Font = titleFont;
ChartChloro2.Titles.Add(titlePS2);
ChartInter2.Titles.Add(titlePS2);
var titlePS3 = new Title("LeafWeb curveID = " + curveID +
"\nInternal conductance estimated, compensation point and M-M constants fixed");
titlePS3.Font = titleFont;
ChartChloro3.Titles.Add(titlePS3);
ChartInter3.Titles.Add(titlePS3);
var titlePS4 = new Title("LeafWeb curveID = " + curveID +
"\nInternal conductance estimated, compensation point and M-M constants estimated");
titlePS4.Font = titleFont;
ChartChloro4.Titles.Add(titlePS4);
ChartInter4.Titles.Add(titlePS4);
ChartChloro1.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartChloro1.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartChloro2.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartChloro2.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartChloro3.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartChloro3.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartChloro4.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartChloro4.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartInter1.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartInter1.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartInter2.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartInter2.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartInter3.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartInter3.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
ChartInter4.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
ChartInter4.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
}
private Series newTPUSeries(ArrayList data)
{
var seriesName = "TPU-limited";
if (data.Count == 0)
seriesName = "Curve Asymptote";
var series3 = new Series(seriesName);
series3.MarkerSize = 9;
series3.BorderWidth = 3;
series3.XValueType = ChartValueType.Double;
series3.ChartType = SeriesChartType.Point;
series3.MarkerStyle = MarkerStyle.Square;
series3.ShadowColor = Color.Black;
series3.BorderColor = Color.Black;
series3.Color = Color.Orange;
series3.ShadowOffset = 0;
series3.YValueType = ChartValueType.Double;
return series3;
}
private void setAnetMeasPoints(ArrayList data, Series series, ref double xMax)
{
// Set the points for the series from the ArrayList
XYPoint xy;
int i;
for (i = 0; i < data.Count; i++)
{
xy = (XYPoint) data[i];
series.Points.AddXY(xy.getX(), xy.getY());
if (xy.getX() > xMax)
xMax = xy.getX();
}
}
private void setAsymptotePoints(ArrayList data, Series series, ref double xMax)
{
// Set the points for the series from the ArrayList
XYPoint xy;
int i;
for (i = 0; i < data.Count; i++)
{
xy = (XYPoint) data[i];
if ((xy.getX() != -9999) && (xy.getY() != -9999))
{
series.Points.AddXY(xy.getX(), xy.getY());
if (xy.getX() > xMax)
xMax = xy.getX();
}
}
}
protected void BackToJobList(object sender, EventArgs e)
{
JobChoosePNL.Visible = true;
ChooseJobErrrorLBL.Visible = false;
CurveChoosePNL.Visible = false;
ChartPNL.Visible = false;
}
private void WriteTrace(String str)
{
var conn = getDbConn();
if (conn != null)
{
var sqlString = "insert into LogEntry (text,logdate) values('" + str + "',getdate())";
var cmd = new SqlCommand(sqlString, conn);
try
{
cmd.ExecuteNonQuery();
}
catch (Exception ex2)
{
conn.Close();
return;
}
conn.Close();
}
}
public static SqlConnection getDbConn()
{
// Determine what environment we are in
var reader = new AppSettingsReader();
var environment = reader.GetValue("UserRealm", Type.GetType("System.String")).ToString();
// Set the datasource based on the environment
string dataSource;
if (environment == "PROD")
dataSource = "mssql.ornl.gov";
else if (environment == "QA")
dataSource = "qamssql.ornl.gov";
else
dataSource = "devmssql.ornl.gov";
// Build the connection string
var connString = "Data Source=" + dataSource + ";Initial Catalog=aci;User ID=xpl;Password=xxxxxxxx;";
SqlConnection conn = null;
try
{
conn = new SqlConnection(connString);
conn.Open();
}
catch (Exception e)
{
var error = e.Message;
return null;
}
return conn;
}
public String encodeSqlQuotes(String str)
{
return str.Replace("'", "''");
}
}
}
+204
View File
@@ -0,0 +1,204 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LeafWeb.Web.Charter {
public partial class LeafWebCharter {
/// <summary>
/// ErrorLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label ErrorLBL;
/// <summary>
/// JobChoosePNL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel JobChoosePNL;
/// <summary>
/// ChooseJobErrrorLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label ChooseJobErrrorLBL;
/// <summary>
/// JobGV control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView JobGV;
/// <summary>
/// CurveChoosePNL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel CurveChoosePNL;
/// <summary>
/// JobNumberLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label JobNumberLBL;
/// <summary>
/// SubmittedByLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label SubmittedByLBL;
/// <summary>
/// JobNameLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label JobNameLBL;
/// <summary>
/// JobDoneDateLBL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label JobDoneDateLBL;
/// <summary>
/// BackToJobListBTN control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button BackToJobListBTN;
/// <summary>
/// CurveDDL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList CurveDDL;
/// <summary>
/// ProduceChartBTN control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button ProduceChartBTN;
/// <summary>
/// ChartPNL control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel ChartPNL;
/// <summary>
/// ChartChloro1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro1;
/// <summary>
/// ChartChloro2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro2;
/// <summary>
/// ChartChloro3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro3;
/// <summary>
/// ChartChloro4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro4;
/// <summary>
/// ChartInter1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter1;
/// <summary>
/// ChartInter2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter2;
/// <summary>
/// ChartInter3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter3;
/// <summary>
/// ChartInter4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter4;
}
}
+78
View File
@@ -0,0 +1,78 @@
using System;
using System.Collections;
using System.IO;
namespace LeafWeb.Web.Charter
{
[Serializable]
public class PiscalOutput
{
private int nbrCurves; // This is the number of input files that were processed.
private readonly ArrayList curveData; // Each element will be a PiscalCurve element that contains
// all of the output data for one curve.
public PiscalOutput()
{
nbrCurves = 0;
curveData = new ArrayList();
}
public bool readFromStream(StreamReader sr, ref String errorMsg)
{
CurveData curve;
// Skip the first two lines.
sr.ReadLine();
sr.ReadLine();
var lineNbr = 2;
// Now, there should be one or more rows, delimited by a row that has
// CO2i in the first field. Read in all of these rows. The first field
// in each row is the curve ID (input filename).
var more = true;
while (more)
{
curve = new CurveData(sr, ref errorMsg, ref lineNbr);
if (errorMsg.Length > 0)
return false;
curveData.Add(curve);
if (sr.EndOfStream)
more = false;
}
return true;
}
public bool readFromDataFile(Stream fileStream, ref String errorMsg)
{
StreamReader sr;
if (fileStream == null)
{
errorMsg = "Please choose a data file first";
return false;
}
try
{
sr = new StreamReader(fileStream);
}
catch (Exception openExc)
{
errorMsg = "Error opening file: " + openExc.Message;
return false;
}
readFromStream(sr, ref errorMsg);
sr.Close();
return true;
}
public ArrayList getCurveData()
{
return curveData;
}
}
}
+51
View File
@@ -0,0 +1,51 @@
using System;
namespace LeafWeb.Web.Charter
{
[Serializable]
public class XYPoint
{
private double x;
private double y;
public XYPoint(double x1, double y1)
{
x = x1;
y = y1;
}
public XYPoint(String x1, String y1)
{
x = Double.Parse(x1);
y = Double.Parse(y1);
}
public double getX()
{
return x;
}
public void setX(double x1)
{
x = x1;
}
public double getY()
{
return y;
}
public void setY(double y1)
{
y = y1;
}
public bool yIsInRange(double lowEnd, double highEnd)
{
if ((y >= lowEnd) && (y <= highEnd))
return true;
else
return false;
}
}
}