Add Leaf Charting

This commit is contained in:
2015-12-02 11:53:15 -05:00
parent 93e0a35cf5
commit 743ea4c3f3
10 changed files with 298 additions and 220 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ using LeafWeb.Core.Utility;
namespace LeafWeb.Core.Services namespace LeafWeb.Core.Services
{ {
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] [AttributeUsage(AttributeTargets.Property)]
public class ParseInfoAttribute : Attribute public class ParseInfoAttribute : Attribute
{ {
public int Position { get; private set; } public int Position { get; private set; }
+1 -1
View File
@@ -27,7 +27,7 @@ namespace LeafWeb.Web.App_Start
bundles.Add(new StyleBundle("~/bundles/css").Include( bundles.Add(new StyleBundle("~/bundles/css").Include(
"~/Content/bootstrap.css", "~/Content/bootstrap.css",
"~/Content/LeafWeb.css" "~/Content/site.css"
)); ));
} }
} }
+2
View File
@@ -8,6 +8,8 @@ namespace LeafWeb.Web.App_Start
public static void RegisterRoutes(RouteCollection routes) public static void RegisterRoutes(RouteCollection routes)
{ {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("Content/{*pathInfo}");
routes.IgnoreRoute("Charter/LeafWebCharter.ascx");
routes.MapRoute( routes.MapRoute(
name: "Default", name: "Default",
+4 -4
View File
@@ -36,22 +36,22 @@ namespace LeafWeb.Web.Charter
return _curveId; return _curveId;
} }
public CurveParamSet GetParamSet1() public CurveParamSet CndctFixedCmpPntFixedParams()
{ {
return _paramSet1; return _paramSet1;
} }
public CurveParamSet GetParamSet2() public CurveParamSet CndctFixedCmpPntEstimatedParams()
{ {
return _paramSet2; return _paramSet2;
} }
public CurveParamSet GetParamSet3() public CurveParamSet CndctEstimatedCmpPntFixedParams()
{ {
return _paramSet3; return _paramSet3;
} }
public CurveParamSet GetParamSet4() public CurveParamSet CndctEstimatedCmpPntEstimatedParams()
{ {
return _paramSet4; return _paramSet4;
} }
+193 -211
View File
@@ -5,6 +5,7 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.DataVisualization.Charting; using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
namespace LeafWeb.Web.Charter namespace LeafWeb.Web.Charter
{ {
@@ -45,7 +46,9 @@ namespace LeafWeb.Web.Charter
//CurveDDL.DataBind(); //CurveDDL.DataBind();
} }
public void ProduceChartBTN_Click(PiscalOutput pisOut)
// cntrlcomparison
public void ProduceCharts(PiscalOutput pisOut)
{ {
// If the session has timed out, use the selected index from the GridView // If the session has timed out, use the selected index from the GridView
// to determine which job to chart. // to determine which job to chart.
@@ -61,249 +64,228 @@ namespace LeafWeb.Web.Charter
var curveData = pisOut.GetCurveData(); var curveData = pisOut.GetCurveData();
var curve = curveData[1]; var curve = curveData[1];
var curveId = curve.GetCurveId(); var curveId = curve.GetCurveId();
CurveSeries(curveId, curve.CndctFixedCmpPntFixedParams(), ChartChloro1, ChartInter1, "Internal conductance fixed, compensation point and M-M constants fixed");
CurveSeries(curveId, curve.CndctFixedCmpPntEstimatedParams(), ChartChloro2, ChartInter2, "Internal conductance fixed, compensation point and M-M constants estimated");
CurveSeries(curveId, curve.CndctEstimatedCmpPntFixedParams(), ChartChloro3, ChartInter3, "Internal conductance estimated, compensation point and M-M constants fixed");
CurveSeries(curveId, curve.CndctEstimatedCmpPntEstimatedParams(), ChartChloro4, ChartInter4, "Internal conductance estimated, compensation point and M-M constants estimated");
}
var paramSet1 = curve.GetParamSet1(); private static Chart GetChart()
var paramSet2 = curve.GetParamSet2(); {
var paramSet3 = curve.GetParamSet3(); var font = new Font(new FontFamily("Trebuchet MS"), 12, FontStyle.Bold);
var paramSet4 = curve.GetParamSet4();
var paramSet1Anet = paramSet1.GetAnetMeasData(); var borderColor = Color.FromArgb(180, 26, 59, 105);
var paramSet2Anet = paramSet2.GetAnetMeasData(); var chart = new Chart
var paramSet3Anet = paramSet3.GetAnetMeasData(); {
var paramSet4Anet = paramSet4.GetAnetMeasData(); BackColor = Color.Transparent,
Width = Unit.Pixel(700),
Height = Unit.Pixel(500),
BorderSkin = {SkinStyle = BorderSkinStyle.Emboss},
BorderColor = borderColor
};
var anetMeasChloro1PS1Data = paramSet1Anet[0]; chart.Legends.Add(new Legend
var anetMeasChloro2PS1Data = paramSet1Anet[1]; {
var anetMeasChloro3PS1Data = paramSet1Anet[2]; Enabled = true,
var anetMeasChloro1PS2Data = paramSet2Anet[0]; IsTextAutoFit = false,
var anetMeasChloro2PS2Data = paramSet2Anet[1]; Name = "Default",
var anetMeasChloro3PS2Data = paramSet2Anet[2]; Docking = Docking.Bottom,
var anetMeasChloro1PS3Data = paramSet3Anet[0]; BackColor = Color.Transparent,
var anetMeasChloro2PS3Data = paramSet3Anet[1]; Font = font
var anetMeasChloro3PS3Data = paramSet3Anet[2]; });
var anetMeasChloro1PS4Data = paramSet4Anet[0];
var anetMeasChloro2PS4Data = paramSet4Anet[1];
var anetMeasChloro3PS4Data = paramSet4Anet[2];
var anetMeasInter1PS1Data = paramSet1Anet[3]; chart.ChartAreas.Add(new ChartArea
var anetMeasInter2PS1Data = paramSet1Anet[4]; {
var anetMeasInter3PS1Data = paramSet1Anet[5]; Name = "ChartArea1",
var anetMeasInter1PS2Data = paramSet2Anet[3]; BorderColor = Color.FromArgb(64, 64, 64, 64),
var anetMeasInter2PS2Data = paramSet2Anet[4]; BorderDashStyle = ChartDashStyle.Solid,
var anetMeasInter3PS2Data = paramSet2Anet[5]; BackSecondaryColor = Color.White,
var anetMeasInter1PS3Data = paramSet3Anet[3]; BackColor = Color.OldLace,
var anetMeasInter2PS3Data = paramSet3Anet[4]; ShadowColor = Color.Transparent,
var anetMeasInter3PS3Data = paramSet3Anet[5]; BackGradientStyle = GradientStyle.TopBottom,
var anetMeasInter1PS4Data = paramSet4Anet[3]; Area3DStyle = new ChartArea3DStyle
var anetMeasInter2PS4Data = paramSet4Anet[4]; {
var anetMeasInter3PS4Data = paramSet4Anet[5]; Rotation = 25,
Perspective = 9,
LightStyle = LightStyle.Realistic,
Inclination = 40,
IsRightAngleAxes = false,
WallWidth = 3,
IsClustered = false
},
AxisY = new Axis
{
LineColor = Color.FromArgb(64, 64, 64, 64),
Title = "Net assimilation rate (umol/m2/s)",
LabelStyle = {Font = font},
MajorGrid = new Grid {LineColor = Color.FromArgb(64, 64, 64, 64)}
}
});
var rubiscoLimited = new Series
{
MarkerSize = 8,
BorderWidth = 3,
XValueType = ChartValueType.Double,
Name = "Rubisco-limited",
ChartType = SeriesChartType.Point,
MarkerStyle = MarkerStyle.Diamond,
ShadowColor = Color.Black,
BorderColor = borderColor,
Color = Color.Red,
ShadowOffset = 0,
YValueType = ChartValueType.Double
};
var rubpRegenerationLimited = new Series
{
MarkerSize = 9,
BorderWidth = 3,
XValueType = ChartValueType.Double,
Name = "RuBP regeneration-limited",
ChartType = SeriesChartType.Point,
MarkerStyle = MarkerStyle.Circle,
ShadowColor = Color.Black,
BorderColor = borderColor,
Color = Color.Blue,
ShadowOffset = 0,
YValueType = ChartValueType.Double
};
var acCurve = new Series
{
MarkerSize = 2,
BorderWidth = 1,
XValueType = ChartValueType.Double,
Name = "acCurve",
ChartType = SeriesChartType.Line,
MarkerStyle = MarkerStyle.None,
ShadowColor = Color.Black,
BorderColor = borderColor,
Color = Color.Red,
ShadowOffset = 0,
YValueType = ChartValueType.Double,
IsVisibleInLegend = false
};
var ajCurve = new Series
{
MarkerSize = 2,
BorderWidth = 1,
XValueType = ChartValueType.Double,
Name = "ajCurve",
ChartType = SeriesChartType.Line,
MarkerStyle = MarkerStyle.None,
ShadowColor = Color.Black,
BorderColor = borderColor,
Color = Color.Blue,
ShadowOffset = 0,
YValueType = ChartValueType.Double,
IsVisibleInLegend = false
};
var atCurve = new Series
{
MarkerSize = 2,
BorderWidth = 1,
XValueType = ChartValueType.Double,
Name = "atCurve",
ChartType = SeriesChartType.Line,
MarkerStyle = MarkerStyle.None,
ShadowColor = Color.Black,
BorderColor = borderColor,
Color = Color.Orange,
ShadowOffset = 0,
YValueType = ChartValueType.Double,
IsVisibleInLegend = false
};
return chart;
}
private static void CurveSeries(string curveId, CurveParamSet paramSet, Chart chloroChart, Chart interChart, string chartTitle)
{
var paramSetAnet = paramSet.GetAnetMeasData();
var anetMeasChloro1 = paramSetAnet[0];
var anetMeasChloro2 = paramSetAnet[1];
var anetMeasChloro3 = paramSetAnet[2];
// Set the points for the symbol series for paramater set 1, chloroplastic // Set the points for the symbol series for paramater set 1, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS1Data, ChartChloro1.Series["Rubisco-limited"]); setAnetMeasPoints(anetMeasChloro1, chloroChart.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS1Data, ChartChloro1.Series["RuBP regeneration-limited"]); setAnetMeasPoints(anetMeasChloro2, chloroChart.Series["RuBP regeneration-limited"]);
var tpuSeries = newTPUSeries(anetMeasChloro3PS1Data); var tpuSeries = newTPUSeries(anetMeasChloro3);
setAnetMeasPoints(anetMeasChloro3PS1Data, tpuSeries); setAnetMeasPoints(anetMeasChloro3, tpuSeries);
ChartChloro1.Series.Add(tpuSeries); chloroChart.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 2, chloroplastic var anetMeasInter1 = paramSetAnet[3];
setAnetMeasPoints(anetMeasChloro1PS2Data, ChartChloro2.Series["Rubisco-limited"]); var anetMeasInter2 = paramSetAnet[4];
setAnetMeasPoints(anetMeasChloro2PS2Data, ChartChloro2.Series["RuBP regeneration-limited"]); var anetMeasInter3 = paramSetAnet[5];
tpuSeries = newTPUSeries(anetMeasChloro3PS2Data);
setAnetMeasPoints(anetMeasChloro3PS2Data, tpuSeries);
ChartChloro2.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 3, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS3Data, ChartChloro3.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS3Data, ChartChloro3.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasChloro3PS3Data);
setAnetMeasPoints(anetMeasChloro3PS3Data, tpuSeries);
ChartChloro3.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 4, chloroplastic
setAnetMeasPoints(anetMeasChloro1PS4Data, ChartChloro4.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasChloro2PS4Data, ChartChloro4.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasChloro3PS4Data);
setAnetMeasPoints(anetMeasChloro3PS4Data, tpuSeries);
ChartChloro4.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 1, intercellular // Set the points for the symbol series for paramater set 1, intercellular
setAnetMeasPoints(anetMeasInter1PS1Data, ChartInter1.Series["Rubisco-limited"]); setAnetMeasPoints(anetMeasInter1, interChart.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS1Data, ChartInter1.Series["RuBP regeneration-limited"]); setAnetMeasPoints(anetMeasInter2, interChart.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS1Data); tpuSeries = newTPUSeries(anetMeasInter3);
setAnetMeasPoints(anetMeasInter3PS1Data, tpuSeries); setAnetMeasPoints(anetMeasInter3, tpuSeries);
ChartInter1.Series.Add(tpuSeries); interChart.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 2, intercellular var acChloroList = paramSet.GetAcChloroData();
setAnetMeasPoints(anetMeasInter1PS2Data, ChartInter2.Series["Rubisco-limited"]); var ajChloroList = paramSet.GetAjChloroData();
setAnetMeasPoints(anetMeasInter2PS2Data, ChartInter2.Series["RuBP regeneration-limited"]); var atChloroList = paramSet.GetAtChloroData();
tpuSeries = newTPUSeries(anetMeasInter3PS2Data);
setAnetMeasPoints(anetMeasInter3PS2Data, tpuSeries);
ChartInter2.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 3, intercellular
setAnetMeasPoints(anetMeasInter1PS3Data, ChartInter3.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS3Data, ChartInter3.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS3Data);
setAnetMeasPoints(anetMeasInter3PS3Data, tpuSeries);
ChartInter3.Series.Add(tpuSeries);
// Set the points for the symbol series for paramater set 4, intercellular
setAnetMeasPoints(anetMeasInter1PS4Data, ChartInter4.Series["Rubisco-limited"]);
setAnetMeasPoints(anetMeasInter2PS4Data, ChartInter4.Series["RuBP regeneration-limited"]);
tpuSeries = newTPUSeries(anetMeasInter3PS4Data);
setAnetMeasPoints(anetMeasInter3PS4Data, tpuSeries);
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 // Set the points on the asymptote curve for parameter set 1, chloroplast
setAsymptotePoints(acChloroListPS1, ChartChloro1.Series["acCurve"]); setAsymptotePoints(acChloroList, chloroChart.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS1, ChartChloro1.Series["ajCurve"]); setAsymptotePoints(ajChloroList, chloroChart.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS1, ChartChloro1.Series["atCurve"]); setAsymptotePoints(atChloroList, chloroChart.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 2, chloroplast var acInterList = paramSet.GetAcInterData();
setAsymptotePoints(acChloroListPS2, ChartChloro2.Series["acCurve"]); var ajInterList = paramSet.GetAjInterData();
setAsymptotePoints(ajChloroListPS2, ChartChloro2.Series["ajCurve"]); var atInterList = paramSet.GetAtInterData();
setAsymptotePoints(atChloroListPS2, ChartChloro2.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 3, chloroplast
setAsymptotePoints(acChloroListPS3, ChartChloro3.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS3, ChartChloro3.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS3, ChartChloro3.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 4, chloroplast
setAsymptotePoints(acChloroListPS4, ChartChloro4.Series["acCurve"]);
setAsymptotePoints(ajChloroListPS4, ChartChloro4.Series["ajCurve"]);
setAsymptotePoints(atChloroListPS4, ChartChloro4.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 1, intercellular // Set the points on the asymptote curve for parameter set 1, intercellular
setAsymptotePoints(acInterListPS1, ChartInter1.Series["acCurve"]); setAsymptotePoints(acInterList, interChart.Series["acCurve"]);
setAsymptotePoints(ajInterListPS1, ChartInter1.Series["ajCurve"]); setAsymptotePoints(ajInterList, interChart.Series["ajCurve"]);
setAsymptotePoints(atInterListPS1, ChartInter1.Series["atCurve"]); setAsymptotePoints(atInterList, interChart.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 2, intercellular
setAsymptotePoints(acInterListPS2, ChartInter2.Series["acCurve"]);
setAsymptotePoints(ajInterListPS2, ChartInter2.Series["ajCurve"]);
setAsymptotePoints(atInterListPS2, ChartInter2.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 3, intercellular
setAsymptotePoints(acInterListPS3, ChartInter3.Series["acCurve"]);
setAsymptotePoints(ajInterListPS3, ChartInter3.Series["ajCurve"]);
setAsymptotePoints(atInterListPS3, ChartInter3.Series["atCurve"]);
// Set the points on the asymptote curve for parameter set 4, intercellular
setAsymptotePoints(acInterListPS4, ChartInter4.Series["acCurve"]);
setAsymptotePoints(ajInterListPS4, ChartInter4.Series["ajCurve"]);
setAsymptotePoints(atInterListPS4, ChartInter4.Series["atCurve"]);
// 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 axisFont = new Font("Times New Roman", 12, FontStyle.Bold);
var titleFont = 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 + var title = new Title("LeafWeb curveID = " + curveId +
"\nInternal conductance fixed, compensation point and M-M constants fixed"); "\n" + chartTitle);
titlePS1.Font = titleFont; title.Font = titleFont;
ChartChloro1.Titles.Add(titlePS1); chloroChart.Titles.Add(title);
ChartInter1.Titles.Add(titlePS1); interChart.Titles.Add(title);
var titlePS2 = new Title("LeafWeb curveID = " + curveId + chloroChart.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
"\nInternal conductance fixed, compensation point and M-M constants estimated"); chloroChart.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
titlePS2.Font = titleFont;
ChartChloro2.Titles.Add(titlePS2);
ChartInter2.Titles.Add(titlePS2);
var titlePS3 = new Title("LeafWeb curveID = " + curveId + interChart.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont;
"\nInternal conductance estimated, compensation point and M-M constants fixed"); interChart.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont;
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(IReadOnlyCollection<XyPoint> data) private static Series newTPUSeries(IReadOnlyCollection<XyPoint> data)
{ {
var seriesName = "TPU-limited"; var seriesName = "TPU-limited";
if (data.Count == 0) if (data.Count == 0)
seriesName = "Curve Asymptote"; seriesName = "Curve Asymptote";
var series3 = new Series(seriesName); var series3 = new Series(seriesName)
series3.MarkerSize = 9; {
series3.BorderWidth = 3; MarkerSize = 9,
series3.XValueType = ChartValueType.Double; BorderWidth = 3,
series3.ChartType = SeriesChartType.Point; XValueType = ChartValueType.Double,
series3.MarkerStyle = MarkerStyle.Square; ChartType = SeriesChartType.Point,
series3.ShadowColor = Color.Black; MarkerStyle = MarkerStyle.Square,
series3.BorderColor = Color.Black; ShadowColor = Color.Black,
series3.Color = Color.Orange; BorderColor = Color.Black,
series3.ShadowOffset = 0; Color = Color.Orange,
series3.YValueType = ChartValueType.Double; ShadowOffset = 0,
YValueType = ChartValueType.Double
};
return series3; return series3;
} }
private void setAnetMeasPoints(List<XyPoint> data, Series series) private static void setAnetMeasPoints(List<XyPoint> data, Series series)
{ {
// Set the points for the series from the ArrayList // Set the points for the series from the ArrayList
foreach (var xy in data) foreach (var xy in data)
@@ -312,7 +294,7 @@ namespace LeafWeb.Web.Charter
} }
} }
private void setAsymptotePoints(List<XyPoint> data, Series series) private static void setAsymptotePoints(List<XyPoint> data, Series series)
{ {
// Set the points for the series from the ArrayList // Set the points for the series from the ArrayList
foreach (var xy in data) foreach (var xy in data)
+2 -1
View File
@@ -7,8 +7,9 @@ namespace LeafWeb.Web.Charter
[Serializable] [Serializable]
public class PiscalOutput public class PiscalOutput
{ {
private readonly List<CurveData> _curveData; // Each element will be a PiscalCurve element that contains // Each element will be a PiscalCurve element that contains
// all of the output data for one curve. // all of the output data for one curve.
private readonly List<CurveData> _curveData;
public PiscalOutput() public PiscalOutput()
{ {
+15
View File
@@ -0,0 +1,15 @@
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -155px; /* the bottom margin is the negative value of the footer's height */
}
footer, .push {
height: 155px; /* .push must be the same height as .footer */
}
+62 -1
View File
@@ -1,4 +1,9 @@
using System.Web.Mvc; using System;
using System.Drawing;
using System.IO;
using System.Web.Mvc;
using System.Web.UI.DataVisualization.Charting;
using System.Web.UI.WebControls;
namespace LeafWeb.Web.Controllers namespace LeafWeb.Web.Controllers
{ {
@@ -33,5 +38,61 @@ namespace LeafWeb.Web.Controllers
{ {
return View(); return View();
} }
public ActionResult LeafCharter()
{
return View();
}
public ActionResult ChartSample()
{
var chart = new Chart
{
BackColor = Color.FromArgb(255, 255, 255),
Width = Unit.Pixel(250),
Height = Unit.Pixel(2500)
};
var series = new Series
{
ChartArea = "ca1",
ChartType = SeriesChartType.Line
};
//series.Font = new Font("Verdana", 8.25f, FontStyle.Regular);
var myRandom = new Random();
for (int i = 0; i < 100; i++)
{
var dp = new DataPoint();
dp.AxisLabel = String.Format("{0}-{1}", i, Guid.NewGuid().ToString().Substring(0, 4));
dp.YValues = new double[] { myRandom.Next(5, 100) };
series.Points.Add(dp);
}
chart.Series.Add(series);
var area = new ChartArea("ca1");
area.Area3DStyle.Enable3D = false;
area.AxisX.Interval = 1;
//area.BackColor = Color.Transparent;
//var labelStyle = new LabelStyle();
//labelStyle.Enabled = true;
//labelStyle.Font = new Font("Arial", 3f);
area.AxisX.LabelStyle.Font = new Font("Verdana", 8.25f, FontStyle.Underline);//Why does it recognize the style but not the font!!!???
chart.ChartAreas.Add(area);
using (var ms = new MemoryStream())
{
chart.SaveImage(ms, ChartImageFormat.Png);
ms.Seek(0, SeekOrigin.Begin);
return File(ms.ToArray(), "image/png", "mychart.png");
}
}
} }
} }
+1
View File
@@ -0,0 +1 @@
<img src="@Url.Action("ChartSample")" alt="image" />
+17 -1
View File
@@ -20,6 +20,7 @@
<IISExpressWindowsAuthentication /> <IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode /> <IISExpressUseClassicPipelineMode />
<WebGreaseLibPath>..\packages\WebGrease.1.5.2\lib</WebGreaseLibPath> <WebGreaseLibPath>..\packages\WebGrease.1.5.2\lib</WebGreaseLibPath>
<UseGlobalApplicationHostFile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -48,6 +49,7 @@
<HintPath>..\packages\Newtonsoft.Json.5.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.5.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System.Web.DataVisualization" />
<Reference Include="System.Web.DynamicData" /> <Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" /> <Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" /> <Reference Include="System.Web.ApplicationServices" />
@@ -104,10 +106,12 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Charter\LeafWebCharter.ascx" />
<Content Include="Content\bootstrap-theme.css" /> <Content Include="Content\bootstrap-theme.css" />
<Content Include="Content\bootstrap-theme.min.css" /> <Content Include="Content\bootstrap-theme.min.css" />
<Content Include="Content\bootstrap.css" /> <Content Include="Content\bootstrap.css" />
<Content Include="Content\bootstrap.min.css" /> <Content Include="Content\bootstrap.min.css" />
<Content Include="Content\site.css" />
<Content Include="fonts\glyphicons-halflings-regular.svg" /> <Content Include="fonts\glyphicons-halflings-regular.svg" />
<Content Include="Global.asax" /> <Content Include="Global.asax" />
<Content Include="Content\Documents\aci_pce_final.pdf" /> <Content Include="Content\Documents\aci_pce_final.pdf" />
@@ -139,6 +143,17 @@
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\BundleConfig.cs" /> <Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" /> <Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Charter\CurveData.cs" />
<Compile Include="Charter\CurveParamSet.cs" />
<Compile Include="Charter\LeafWebCharter.ascx.cs">
<DependentUpon>LeafWebCharter.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Charter\LeafWebCharter.ascx.designer.cs">
<DependentUpon>LeafWebCharter.ascx</DependentUpon>
</Compile>
<Compile Include="Charter\PiscalOutput.cs" />
<Compile Include="Charter\XYPoint.cs" />
<Compile Include="Controllers\PagesController.cs" /> <Compile Include="Controllers\PagesController.cs" />
<Compile Include="Global.asax.cs"> <Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon> <DependentUpon>Global.asax</DependentUpon>
@@ -157,6 +172,7 @@
<Content Include="Views\_ViewStart.cshtml" /> <Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\Pages\DataRequirements.cshtml" /> <Content Include="Views\Pages\DataRequirements.cshtml" />
<Content Include="Scripts\jquery-1.9.1.min.map" /> <Content Include="Scripts\jquery-1.9.1.min.map" />
<Content Include="Views\Pages\LeafCharter.cshtml" />
<None Include="Web.Debug.config"> <None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon> <DependentUpon>Web.config</DependentUpon>
</None> </None>
@@ -181,7 +197,7 @@
<WebProjectProperties> <WebProjectProperties>
<UseIIS>True</UseIIS> <UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>0</DevelopmentServerPort> <DevelopmentServerPort>34173</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:1640/</IISUrl> <IISUrl>http://localhost:1640/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>