diff --git a/Web/Charter/LeafWebCharter.ascx b/Web/Charter/LeafWebCharter.ascx deleted file mode 100644 index 52aea7a..0000000 --- a/Web/Charter/LeafWebCharter.ascx +++ /dev/null @@ -1,450 +0,0 @@ -<%@ 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" %> - - -
-

Charting the Output from LeafWeb Jobs

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Web/Charter/LeafWebCharter.ascx.cs b/Web/Charter/LeafWebCharter.ascx.cs deleted file mode 100644 index 1d9b842..0000000 --- a/Web/Charter/LeafWebCharter.ascx.cs +++ /dev/null @@ -1,307 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Drawing; -using System.IO; -using System.Web.UI; -using System.Web.UI.DataVisualization.Charting; -using System.Web.UI.WebControls; -using LeafWeb.Core.Charter; -using LeafWeb.Core.Models; - -namespace LeafWeb.Web.Charter -{ - public partial class LeafWebCharter : UserControl - { - protected void ReadFile(StreamReader sr, ref string errMsg) - { - var pisOut = new CurveDataList(); - if (!pisOut.ReadFromStream(sr)) - { - ErrorLBL.Text = errMsg; - ErrorLBL.Visible = true; - return; - } - Session["LeafChartData"] = pisOut; - var aCopy = (CurveDataList) 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")); - - var curveData = pisOut.CurveData; - for (var i = 0; i < curveData.Count; i++) - { - var aCurve = curveData[i]; - var dr = curveDT.NewRow(); - dr["curveID"] = aCurve.CurveId; - curveDT.Rows.Add(dr); - } - - //CurveDDL.DataSource = curveDT; - //CurveDDL.DataTextField = "curveID"; - //CurveDDL.DataValueField = "curveID"; - //CurveDDL.DataBind(); - } - - - // cntrlcomparison - public void ProduceCharts(CurveDataList pisOut) - { - // If the session has timed out, use the selected index from the GridView - // to determine which job to chart. - - // if (aFile.Name.Contains("cntrlcomparison")) - // { - // var sr = new StreamReader(aFile.OpenBinaryStream()); - // var errorMessage = ""; - // ReadFile(sr, ref errorMessage); - // sr.Close(); - // break; - // } - - var curveData = pisOut.CurveData; - var curve = curveData[1]; - - var curveId = curve.CurveId; - CurveSeries(curveId, curve.FixedCndFixedCmp, ChartChloro1, ChartInter1, "Internal conductance fixed, compensation point and M-M constants fixed"); - CurveSeries(curveId, curve.FixedCndEstimatedCmp, ChartChloro2, ChartInter2, "Internal conductance fixed, compensation point and M-M constants estimated"); - CurveSeries(curveId, curve.EstimatedCndFixedCmp, ChartChloro3, ChartInter3, "Internal conductance estimated, compensation point and M-M constants fixed"); - CurveSeries(curveId, curve.EstimatedCndEstimatedCmp, ChartChloro4, ChartInter4, "Internal conductance estimated, compensation point and M-M constants estimated"); - } - - private static Chart GetChart() - { - var font = new Font(new FontFamily("Trebuchet MS"), 12, FontStyle.Bold); - - var borderColor = Color.FromArgb(180, 26, 59, 105); - var chart = new Chart - { - BackColor = Color.Transparent, - Width = Unit.Pixel(700), - Height = Unit.Pixel(500), - BorderSkin = {SkinStyle = BorderSkinStyle.Emboss}, - BorderColor = borderColor - }; - - chart.Legends.Add(new Legend - { - Enabled = true, - IsTextAutoFit = false, - Name = "Default", - Docking = Docking.Bottom, - BackColor = Color.Transparent, - Font = font - }); - - chart.ChartAreas.Add(new ChartArea - { - Name = "ChartArea1", - BorderColor = Color.FromArgb(64, 64, 64, 64), - BorderDashStyle = ChartDashStyle.Solid, - BackSecondaryColor = Color.White, - BackColor = Color.OldLace, - ShadowColor = Color.Transparent, - BackGradientStyle = GradientStyle.TopBottom, - Area3DStyle = new ChartArea3DStyle - { - 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 anetMeasChloro1 = paramSet.AnetMeasChloro1Data; - var anetMeasChloro2 = paramSet.AnetMeasChloro2Data; - var anetMeasChloro3 = paramSet.AnetMeasChloro3Data; - - // Set the points for the symbol series for paramater set 1, chloroplastic - setAnetMeasPoints(anetMeasChloro1, chloroChart.Series["Rubisco-limited"]); - setAnetMeasPoints(anetMeasChloro2, chloroChart.Series["RuBP regeneration-limited"]); - - var tpuSeries = newTPUSeries(anetMeasChloro3); - setAnetMeasPoints(anetMeasChloro3, tpuSeries); - chloroChart.Series.Add(tpuSeries); - - var anetMeasInter1 = paramSet.AnetMeasInter1Data; - var anetMeasInter2 = paramSet.AnetMeasInter2Data; - var anetMeasInter3 = paramSet.AnetMeasInter3Data; - - // Set the points for the symbol series for paramater set 1, intercellular - setAnetMeasPoints(anetMeasInter1, interChart.Series["Rubisco-limited"]); - setAnetMeasPoints(anetMeasInter2, interChart.Series["RuBP regeneration-limited"]); - - tpuSeries = newTPUSeries(anetMeasInter3); - setAnetMeasPoints(anetMeasInter3, tpuSeries); - interChart.Series.Add(tpuSeries); - - var acChloroList = paramSet.AcChloroData; - var ajChloroList = paramSet.AjChloroData; - var atChloroList = paramSet.AtChloroData; - - // Set the points on the asymptote curve for parameter set 1, chloroplast - setAsymptotePoints(acChloroList, chloroChart.Series["acCurve"]); - setAsymptotePoints(ajChloroList, chloroChart.Series["ajCurve"]); - setAsymptotePoints(atChloroList, chloroChart.Series["atCurve"]); - - var acInterList = paramSet.AcInterData; - var ajInterList = paramSet.AjInterData; - var atInterList = paramSet.AtInterData; - - // Set the points on the asymptote curve for parameter set 1, intercellular - setAsymptotePoints(acInterList, interChart.Series["acCurve"]); - setAsymptotePoints(ajInterList, interChart.Series["ajCurve"]); - setAsymptotePoints(atInterList, interChart.Series["atCurve"]); - - var axisFont = new Font("Times New Roman", 12, FontStyle.Bold); - var titleFont = new Font("Times New Roman", 12, FontStyle.Bold); - - var title = new Title("LeafWeb curveID = " + curveId + - "\n" + chartTitle) {Font = titleFont}; - chloroChart.Titles.Add(title); - interChart.Titles.Add(title); - - chloroChart.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont; - chloroChart.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont; - - interChart.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont; - interChart.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont; - } - - private static Series newTPUSeries(IReadOnlyCollection data) - { - var seriesName = "TPU-limited"; - if (data.Count == 0) - seriesName = "Curve Asymptote"; - var series3 = new Series(seriesName) - { - MarkerSize = 9, - BorderWidth = 3, - XValueType = ChartValueType.Double, - ChartType = SeriesChartType.Point, - MarkerStyle = MarkerStyle.Square, - ShadowColor = Color.Black, - BorderColor = Color.Black, - Color = Color.Orange, - ShadowOffset = 0, - YValueType = ChartValueType.Double - }; - - return series3; - } - - private static void setAnetMeasPoints(List data, Series series) - { - // Set the points for the series from the ArrayList - foreach (var xy in data) - { - series.Points.AddXY(xy.X, xy.Y); - } - } - - private static void setAsymptotePoints(List data, Series series) - { - // Set the points for the series from the ArrayList - foreach (var xy in data) - { - if ((xy.X != -9999) && (xy.Y != -9999)) - { - series.Points.AddXY(xy.X, xy.Y); - } - } - } - } -} \ No newline at end of file diff --git a/Web/Charter/LeafWebCharter.ascx.designer.cs b/Web/Charter/LeafWebCharter.ascx.designer.cs deleted file mode 100644 index beb0acd..0000000 --- a/Web/Charter/LeafWebCharter.ascx.designer.cs +++ /dev/null @@ -1,105 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace LeafWeb.Web.Charter { - - - public partial class LeafWebCharter { - - /// - /// ErrorLBL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Label ErrorLBL; - - /// - /// ChartPNL control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel ChartPNL; - - /// - /// ChartChloro1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro1; - - /// - /// ChartChloro2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro2; - - /// - /// ChartChloro3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro3; - - /// - /// ChartChloro4 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartChloro4; - - /// - /// ChartInter1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter1; - - /// - /// ChartInter2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter2; - - /// - /// ChartInter3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter3; - - /// - /// ChartInter4 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.DataVisualization.Charting.Chart ChartInter4; - } -} diff --git a/Web/Charter/LeafWebCharter.cs b/Web/Charter/LeafWebCharter.cs new file mode 100644 index 0000000..654db61 --- /dev/null +++ b/Web/Charter/LeafWebCharter.cs @@ -0,0 +1,285 @@ +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Web.UI.DataVisualization.Charting; +using System.Web.UI.WebControls; +using LeafWeb.Core.Charter; + +namespace LeafWeb.Web.Charter +{ + public static class LeafWebCharter + { + // cntrlcomparison + public static IEnumerable ProduceCharts(List curveData) + { + var curve = curveData[1]; // TODO: why is only the [1] used? + + var curveId = curve.CurveId; + + var fcfc = CurveSeries(curveId, curve.FixedCndFixedCmp, + "Internal conductance fixed, compensation point and M-M constants fixed"); + var fcec = CurveSeries(curveId, curve.FixedCndEstimatedCmp, + "Internal conductance fixed, compensation point and M-M constants estimated"); + var ecfc = CurveSeries(curveId, curve.EstimatedCndFixedCmp, + "Internal conductance estimated, compensation point and M-M constants fixed"); + var ecec = CurveSeries(curveId, curve.EstimatedCndEstimatedCmp, + "Internal conductance estimated, compensation point and M-M constants estimated"); + + return new[] {fcfc, fcec, ecfc, ecec}.SelectMany(c => c); + } + + private static IEnumerable CurveSeries(string curveId, CurveParamSet paramSet, string chartTitle) + { + var chloroChart = GetChart("Chloroplastic CO2 partial pressure (Pa)"); + var interChart = GetChart("Intercellular CO2 partial pressure (Pa)"); + + var anetMeasChloro1 = paramSet.AnetMeasChloro1Data; + var anetMeasChloro2 = paramSet.AnetMeasChloro2Data; + var anetMeasChloro3 = paramSet.AnetMeasChloro3Data; + + // Set the points for the symbol series for paramater set 1, chloroplastic + SetAnetMeasPoints(anetMeasChloro1, chloroChart.Series["Rubisco-limited"]); + SetAnetMeasPoints(anetMeasChloro2, chloroChart.Series["RuBP regeneration-limited"]); + + var tpuSeries = NewTpuSeries(anetMeasChloro3); + SetAnetMeasPoints(anetMeasChloro3, tpuSeries); + chloroChart.Series.Add(tpuSeries); + + var anetMeasInter1 = paramSet.AnetMeasInter1Data; + var anetMeasInter2 = paramSet.AnetMeasInter2Data; + var anetMeasInter3 = paramSet.AnetMeasInter3Data; + + // Set the points for the symbol series for paramater set 1, intercellular + SetAnetMeasPoints(anetMeasInter1, interChart.Series["Rubisco-limited"]); + SetAnetMeasPoints(anetMeasInter2, interChart.Series["RuBP regeneration-limited"]); + + tpuSeries = NewTpuSeries(anetMeasInter3); + SetAnetMeasPoints(anetMeasInter3, tpuSeries); + interChart.Series.Add(tpuSeries); + + var acChloroList = paramSet.AcChloroData; + var ajChloroList = paramSet.AjChloroData; + var atChloroList = paramSet.AtChloroData; + + // Set the points on the asymptote curve for parameter set 1, chloroplast + SetAsymptotePoints(acChloroList, chloroChart.Series["acCurve"]); + SetAsymptotePoints(ajChloroList, chloroChart.Series["ajCurve"]); + SetAsymptotePoints(atChloroList, chloroChart.Series["atCurve"]); + + var acInterList = paramSet.AcInterData; + var ajInterList = paramSet.AjInterData; + var atInterList = paramSet.AtInterData; + + // Set the points on the asymptote curve for parameter set 1, intercellular + SetAsymptotePoints(acInterList, interChart.Series["acCurve"]); + SetAsymptotePoints(ajInterList, interChart.Series["ajCurve"]); + SetAsymptotePoints(atInterList, interChart.Series["atCurve"]); + + var axisFont = new Font("Times New Roman", 12, FontStyle.Bold); + var titleFont = new Font("Times New Roman", 12, FontStyle.Bold); + + var title = new Title("LeafWeb curveID = " + curveId + + "\n" + chartTitle) + {Font = titleFont}; + chloroChart.Titles.Add(title); + interChart.Titles.Add(title); + + chloroChart.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont; + chloroChart.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont; + + interChart.ChartAreas["ChartArea1"].AxisX.TitleFont = axisFont; + interChart.ChartAreas["ChartArea1"].AxisY.TitleFont = axisFont; + yield return chloroChart; + yield return interChart; + } + + private static Series NewTpuSeries(IReadOnlyCollection data) + { + var seriesName = "TPU-limited"; + if (data.Count == 0) + seriesName = "Curve Asymptote"; + var series3 = new Series(seriesName) + { + MarkerSize = 9, + BorderWidth = 3, + XValueType = ChartValueType.Double, + ChartType = SeriesChartType.Point, + MarkerStyle = MarkerStyle.Square, + ShadowColor = Color.Black, + BorderColor = Color.Black, + Color = Color.Orange, + ShadowOffset = 0, + YValueType = ChartValueType.Double + }; + + return series3; + } + + private static void SetAnetMeasPoints(List data, Series series) + { + // Set the points for the series from the ArrayList + foreach (var xy in data) + { + series.Points.AddXY(xy.X, xy.Y); + } + } + + private static void SetAsymptotePoints(List data, Series series) + { + // Set the points for the series from the ArrayList + foreach (var xy in data) + { + if ((xy.X != -9999) && (xy.Y != -9999)) + { + series.Points.AddXY(xy.X, xy.Y); + } + } + } + + private static Chart GetChart(string axisXTitle, int width=700, int height=500) + { + var font = new Font(new FontFamily("Trebuchet MS"), 12, FontStyle.Bold); + + var borderColor = Color.FromArgb(180, 26, 59, 105); + var chart = new Chart + { + BackColor = Color.White, + Width = Unit.Pixel(width), + Height = Unit.Pixel(height), + BorderSkin = {SkinStyle = BorderSkinStyle.Emboss}, + BorderColor = borderColor + }; + + chart.Legends.Add(new Legend + { + Enabled = true, + IsTextAutoFit = false, + Name = "Default", + Docking = Docking.Bottom, + BackColor = Color.Transparent, + Font = font + }); + + chart.ChartAreas.Add(new ChartArea + { + Name = "ChartArea1", + BorderColor = Color.FromArgb(64, 64, 64, 64), + BorderDashStyle = ChartDashStyle.Solid, + BackSecondaryColor = Color.White, + BackColor = Color.OldLace, + ShadowColor = Color.Transparent, + BackGradientStyle = GradientStyle.TopBottom, + Area3DStyle = new ChartArea3DStyle + { + 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)} + }, + AxisX = new Axis + { + LineColor = Color.FromArgb(64, 64, 64, 64), + Minimum = 0, + Title = axisXTitle, + 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 + }; + chart.Series.Add(rubiscoLimited); + + 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 + }; + chart.Series.Add(rubpRegenerationLimited); + + 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 + }; + chart.Series.Add(acCurve); + + 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 + }; + chart.Series.Add(ajCurve); + + 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 + }; + chart.Series.Add(atCurve); + + return chart; + } + } +} \ No newline at end of file diff --git a/Web/Controllers/LeafCharterController.cs b/Web/Controllers/LeafCharterController.cs index 0ce3c62..7391076 100644 --- a/Web/Controllers/LeafCharterController.cs +++ b/Web/Controllers/LeafCharterController.cs @@ -7,6 +7,8 @@ using System.Web; using System.Web.Mvc; using System.Web.UI.DataVisualization.Charting; using System.Web.UI.WebControls; +using LeafWeb.Core.Charter; +using LeafWeb.Web.Charter; namespace LeafWeb.Web.Controllers { @@ -17,6 +19,25 @@ namespace LeafWeb.Web.Controllers return View(); } + public ActionResult LeafCharts(int number) + { + var fileInfo = new FileInfo(@"C:\Users\poprhythm\Documents\code\LeafWeb\Core.Tests\Parsers\LeafOutputData\cntrlcomparison_Wild Capsicum.csv"); + var curveDataList = new CurveDataList(); + using (var reader = fileInfo.OpenText()) + { + curveDataList.ReadFromStream(reader); + } + var charts = LeafWebCharter.ProduceCharts(curveDataList.CurveData); + + using (var ms = new MemoryStream()) + { + charts.Skip(number).First().SaveImage(ms, ChartImageFormat.Png); + ms.Seek(0, SeekOrigin.Begin); + + return File(ms.ToArray(), "image/png", "mychart.png"); + } + } + public ActionResult ChartSample() { var chart = new Chart diff --git a/Web/Views/LeafCharter/Index.cshtml b/Web/Views/LeafCharter/Index.cshtml index 0130a4b..3d42a7a 100644 --- a/Web/Views/LeafCharter/Index.cshtml +++ b/Web/Views/LeafCharter/Index.cshtml @@ -1 +1,8 @@ -image \ No newline at end of file +image +image +image +image +image +image +image +image \ No newline at end of file diff --git a/Web/Web.csproj b/Web/Web.csproj index fa798cb..0344369 100644 --- a/Web/Web.csproj +++ b/Web/Web.csproj @@ -106,7 +106,6 @@ - @@ -143,13 +142,7 @@ - - LeafWebCharter.ascx - ASPXCodeBehind - - - LeafWebCharter.ascx - +