Add a multiplier to the charting size, to produce larger charts
This commit is contained in:
@@ -1 +1 @@
|
|||||||
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.0nm7wrgc.dll
|
C:\Users\poprhythm\AppData\Local\Temp\Temporary ASP.NET Files\vs\f80e29bb\faae20bf\App_Web_all.generated.cs.8f9494c4.pdoxzkxo.dll
|
||||||
@@ -121,7 +121,7 @@ namespace LeafWeb.WebCms.Controllers
|
|||||||
|
|
||||||
private IEnumerable<Bitmap> GetChartBitmaps(CurveData curveData)
|
private IEnumerable<Bitmap> GetChartBitmaps(CurveData curveData)
|
||||||
{
|
{
|
||||||
var charts = LeafGasCharter.ProduceCharts(curveData);
|
var charts = LeafGasCharter.ProduceCharts(curveData, 1.5);
|
||||||
|
|
||||||
foreach (var chart in charts)
|
foreach (var chart in charts)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,30 +11,85 @@ namespace LeafWeb.WebCms.Services
|
|||||||
{
|
{
|
||||||
public static class LeafGasCharter
|
public static class LeafGasCharter
|
||||||
{
|
{
|
||||||
private static readonly Font TitleFont = new Font(new FontFamily("Times New Roman"), 10, FontStyle.Bold);
|
private struct Fonts
|
||||||
private static readonly Font AxisFont = new Font(new FontFamily("Times New Roman"), 10, FontStyle.Bold);
|
{
|
||||||
private static readonly Font Font = new Font(new FontFamily("Trebuchet MS"), 9, FontStyle.Bold);
|
public Font Regular { get; }
|
||||||
public const int ChartWidth = 550;
|
public Font Title { get; }
|
||||||
public const int ChartHeight = 400;
|
public Font Axis { get; }
|
||||||
|
|
||||||
// cntrlcomparison
|
public Fonts(double multiplier)
|
||||||
public static IEnumerable<Chart> ProduceCharts(CurveData curve)
|
{
|
||||||
|
var regSize = CeilingMultiply(9, multiplier);
|
||||||
|
var titleSize = CeilingMultiply(10, multiplier);
|
||||||
|
Regular = new Font(new FontFamily("Trebuchet MS"), regSize, FontStyle.Bold);
|
||||||
|
Title = new Font(new FontFamily("Times New Roman"), titleSize, FontStyle.Bold);
|
||||||
|
Axis = new Font(new FontFamily("Times New Roman"), titleSize, FontStyle.Bold);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct ChartSizes
|
||||||
|
{
|
||||||
|
public int Width { get; }
|
||||||
|
public int Height { get; }
|
||||||
|
public int BorderlineWidth { get; }
|
||||||
|
|
||||||
|
public int RubiscoLimitedMarkerSize { get; }
|
||||||
|
public int RubiscoLimitedBorderWidth { get; }
|
||||||
|
|
||||||
|
public int RuBPMarkerSize { get; }
|
||||||
|
public int RuBPBorderWidth { get; }
|
||||||
|
|
||||||
|
public int TpuLimitedMarkerSize { get; }
|
||||||
|
public int TpuLimitedBorderWidth { get; }
|
||||||
|
|
||||||
|
public int aCurveMarkerSize { get; }
|
||||||
|
public int aCurveBorderWidth { get; }
|
||||||
|
|
||||||
|
public ChartSizes(double multiplier)
|
||||||
|
{
|
||||||
|
Width = CeilingMultiply(550, multiplier);
|
||||||
|
Height = CeilingMultiply(400, multiplier);
|
||||||
|
BorderlineWidth = CeilingMultiply(1, multiplier);
|
||||||
|
|
||||||
|
RubiscoLimitedMarkerSize = CeilingMultiply(8, multiplier);
|
||||||
|
RubiscoLimitedBorderWidth = CeilingMultiply(3, multiplier);
|
||||||
|
|
||||||
|
RuBPMarkerSize = CeilingMultiply(9, multiplier);
|
||||||
|
RuBPBorderWidth = CeilingMultiply(3, multiplier);
|
||||||
|
|
||||||
|
TpuLimitedMarkerSize = CeilingMultiply(9, multiplier);
|
||||||
|
TpuLimitedBorderWidth = CeilingMultiply(3, multiplier);
|
||||||
|
|
||||||
|
aCurveMarkerSize = CeilingMultiply(2, multiplier);
|
||||||
|
aCurveBorderWidth = CeilingMultiply(1, multiplier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int CeilingMultiply(int num, double multiplier)
|
||||||
|
{
|
||||||
|
return Convert.ToInt32(Math.Ceiling(num * multiplier));
|
||||||
|
}
|
||||||
|
|
||||||
|
// cntrlcomparison
|
||||||
|
public static IEnumerable<Chart> ProduceCharts(CurveData curve, double multiplier = 1d)
|
||||||
{
|
{
|
||||||
var curveId = curve.CurveId;
|
var curveId = curve.CurveId;
|
||||||
|
var fonts = new Fonts(multiplier);
|
||||||
|
var sizes = new ChartSizes(multiplier);
|
||||||
|
|
||||||
return curve.ParamSets.SelectMany(item => CurveSeries(curveId, item, item.CurveType.GetDescription()));
|
return curve.ParamSets.SelectMany(item => CurveSeries(curveId, item, item.CurveType.GetDescription(), sizes, fonts));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<Chart> CurveSeries(string curveId, CurveParamSet paramSet, string chartTitle)
|
private static IEnumerable<Chart> CurveSeries(string curveId, CurveParamSet paramSet, string chartTitle, ChartSizes sizes, Fonts fonts)
|
||||||
{
|
{
|
||||||
var chloroChart = CreateEmptyChart("Chloroplastic CO2 partial pressure (Pa)", ChartWidth, ChartHeight);
|
var chloroChart = CreateEmptyChart("Chloroplastic CO2 partial pressure (Pa)", sizes, fonts);
|
||||||
var interChart = CreateEmptyChart("Intercellular CO2 partial pressure (Pa)", ChartWidth, ChartHeight);
|
var interChart = CreateEmptyChart("Intercellular CO2 partial pressure (Pa)", sizes, fonts);
|
||||||
|
|
||||||
// Set the points for the symbol series for paramater set 1, chloroplastic
|
// Set the points for the symbol series for paramater set 1, chloroplastic
|
||||||
AddAnetMeasPoints(paramSet.AnetMeasChloro1Data, chloroChart.Series["Rubisco-limited"]);
|
AddAnetMeasPoints(paramSet.AnetMeasChloro1Data, chloroChart.Series["Rubisco-limited"]);
|
||||||
AddAnetMeasPoints(paramSet.AnetMeasChloro2Data, chloroChart.Series["RuBP regeneration-limited"]);
|
AddAnetMeasPoints(paramSet.AnetMeasChloro2Data, chloroChart.Series["RuBP regeneration-limited"]);
|
||||||
|
|
||||||
var tpuSeries = NewTpuSeries(paramSet.AnetMeasChloro3Data);
|
var tpuSeries = NewTpuSeries(paramSet.AnetMeasChloro3Data, sizes);
|
||||||
AddAnetMeasPoints(paramSet.AnetMeasChloro3Data, tpuSeries);
|
AddAnetMeasPoints(paramSet.AnetMeasChloro3Data, tpuSeries);
|
||||||
chloroChart.Series.Add(tpuSeries);
|
chloroChart.Series.Add(tpuSeries);
|
||||||
|
|
||||||
@@ -42,7 +97,7 @@ namespace LeafWeb.WebCms.Services
|
|||||||
AddAnetMeasPoints(paramSet.AnetMeasInter1Data, interChart.Series["Rubisco-limited"]);
|
AddAnetMeasPoints(paramSet.AnetMeasInter1Data, interChart.Series["Rubisco-limited"]);
|
||||||
AddAnetMeasPoints(paramSet.AnetMeasInter2Data, interChart.Series["RuBP regeneration-limited"]);
|
AddAnetMeasPoints(paramSet.AnetMeasInter2Data, interChart.Series["RuBP regeneration-limited"]);
|
||||||
|
|
||||||
tpuSeries = NewTpuSeries(paramSet.AnetMeasInter3Data);
|
tpuSeries = NewTpuSeries(paramSet.AnetMeasInter3Data, sizes);
|
||||||
AddAnetMeasPoints(paramSet.AnetMeasInter3Data, tpuSeries);
|
AddAnetMeasPoints(paramSet.AnetMeasInter3Data, tpuSeries);
|
||||||
interChart.Series.Add(tpuSeries);
|
interChart.Series.Add(tpuSeries);
|
||||||
|
|
||||||
@@ -56,29 +111,29 @@ namespace LeafWeb.WebCms.Services
|
|||||||
AddAsymptotePoints(paramSet.AjInterData, interChart.Series["ajCurve"]);
|
AddAsymptotePoints(paramSet.AjInterData, interChart.Series["ajCurve"]);
|
||||||
AddAsymptotePoints(paramSet.AtInterData, interChart.Series["atCurve"]);
|
AddAsymptotePoints(paramSet.AtInterData, interChart.Series["atCurve"]);
|
||||||
|
|
||||||
var title = new Title($"LeafWeb curveID = {curveId}\n{chartTitle}"){Font = TitleFont};
|
var title = new Title($"LeafWeb curveID = {curveId}\n{chartTitle}"){Font = fonts.Title};
|
||||||
chloroChart.Titles.Add(title);
|
chloroChart.Titles.Add(title);
|
||||||
interChart.Titles.Add(title);
|
interChart.Titles.Add(title);
|
||||||
|
|
||||||
chloroChart.ChartAreas["ChartArea"].AxisX.TitleFont = AxisFont;
|
chloroChart.ChartAreas["ChartArea"].AxisX.TitleFont = fonts.Axis;
|
||||||
chloroChart.ChartAreas["ChartArea"].AxisY.TitleFont = AxisFont;
|
chloroChart.ChartAreas["ChartArea"].AxisY.TitleFont = fonts.Axis;
|
||||||
|
|
||||||
interChart.ChartAreas["ChartArea"].AxisX.TitleFont = AxisFont;
|
interChart.ChartAreas["ChartArea"].AxisX.TitleFont = fonts.Axis;
|
||||||
interChart.ChartAreas["ChartArea"].AxisY.TitleFont = AxisFont;
|
interChart.ChartAreas["ChartArea"].AxisY.TitleFont = fonts.Axis;
|
||||||
|
|
||||||
yield return chloroChart;
|
yield return chloroChart;
|
||||||
yield return interChart;
|
yield return interChart;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Series NewTpuSeries(IReadOnlyCollection<XyPoint> data)
|
private static Series NewTpuSeries(IReadOnlyCollection<XyPoint> data, ChartSizes sizes)
|
||||||
{
|
{
|
||||||
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)
|
||||||
{
|
{
|
||||||
MarkerSize = 9,
|
MarkerSize = sizes.TpuLimitedMarkerSize,
|
||||||
BorderWidth = 3,
|
BorderWidth = sizes.TpuLimitedBorderWidth,
|
||||||
XValueType = ChartValueType.Double,
|
XValueType = ChartValueType.Double,
|
||||||
ChartType = SeriesChartType.Point,
|
ChartType = SeriesChartType.Point,
|
||||||
MarkerStyle = MarkerStyle.Square,
|
MarkerStyle = MarkerStyle.Square,
|
||||||
@@ -110,18 +165,18 @@ namespace LeafWeb.WebCms.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Chart CreateEmptyChart(string axisXTitle, int width=700, int height=500)
|
private static Chart CreateEmptyChart(string axisXTitle, ChartSizes sizes, Fonts fonts)
|
||||||
{
|
{
|
||||||
var borderColor = Color.FromArgb(180, 26, 59, 105);
|
var borderColor = Color.FromArgb(180, 26, 59, 105);
|
||||||
var chart = new Chart
|
var chart = new Chart
|
||||||
{
|
{
|
||||||
BackColor = Color.White,
|
BackColor = Color.White,
|
||||||
Width = Unit.Pixel(width),
|
Width = Unit.Pixel(sizes.Width),
|
||||||
Height = Unit.Pixel(height),
|
Height = Unit.Pixel(sizes.Height),
|
||||||
//BorderSkin = {SkinStyle = BorderSkinStyle.None},
|
//BorderSkin = {SkinStyle = BorderSkinStyle.None},
|
||||||
BorderColor = borderColor,
|
BorderColor = borderColor,
|
||||||
BorderlineColor = borderColor,
|
BorderlineColor = borderColor,
|
||||||
BorderlineWidth = 1,
|
BorderlineWidth = sizes.BorderlineWidth,
|
||||||
BorderlineDashStyle = ChartDashStyle.Solid
|
BorderlineDashStyle = ChartDashStyle.Solid
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,8 +187,8 @@ namespace LeafWeb.WebCms.Services
|
|||||||
Name = "Default",
|
Name = "Default",
|
||||||
Docking = Docking.Bottom,
|
Docking = Docking.Bottom,
|
||||||
BackColor = Color.Transparent,
|
BackColor = Color.Transparent,
|
||||||
Font = Font
|
Font = fonts.Regular
|
||||||
});
|
});
|
||||||
|
|
||||||
chart.ChartAreas.Add(new ChartArea
|
chart.ChartAreas.Add(new ChartArea
|
||||||
{
|
{
|
||||||
@@ -148,7 +203,7 @@ namespace LeafWeb.WebCms.Services
|
|||||||
{
|
{
|
||||||
LineColor = Color.FromArgb(64, 64, 64, 64),
|
LineColor = Color.FromArgb(64, 64, 64, 64),
|
||||||
Title = "Net assimilation rate (umol/m2/s)",
|
Title = "Net assimilation rate (umol/m2/s)",
|
||||||
LabelStyle = { Font = Font },
|
LabelStyle = { Font = fonts.Regular },
|
||||||
MajorGrid = new Grid { LineColor = Color.FromArgb(64, 64, 64, 64)}
|
MajorGrid = new Grid { LineColor = Color.FromArgb(64, 64, 64, 64)}
|
||||||
},
|
},
|
||||||
AxisX = new Axis
|
AxisX = new Axis
|
||||||
@@ -156,15 +211,15 @@ namespace LeafWeb.WebCms.Services
|
|||||||
LineColor = Color.FromArgb(64, 64, 64, 64),
|
LineColor = Color.FromArgb(64, 64, 64, 64),
|
||||||
Minimum = 0,
|
Minimum = 0,
|
||||||
Title = axisXTitle,
|
Title = axisXTitle,
|
||||||
LabelStyle = { Font = Font },
|
LabelStyle = { Font = fonts.Regular },
|
||||||
MajorGrid = new Grid { LineColor = Color.FromArgb(64, 64, 64, 64)}
|
MajorGrid = new Grid { LineColor = Color.FromArgb(64, 64, 64, 64)}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
chart.Series.Add(new Series
|
chart.Series.Add(new Series
|
||||||
{
|
{
|
||||||
MarkerSize = 8,
|
MarkerSize = sizes.RubiscoLimitedMarkerSize,
|
||||||
BorderWidth = 3,
|
BorderWidth = sizes.RubiscoLimitedBorderWidth,
|
||||||
XValueType = ChartValueType.Double,
|
XValueType = ChartValueType.Double,
|
||||||
Name = "Rubisco-limited",
|
Name = "Rubisco-limited",
|
||||||
ChartType = SeriesChartType.Point,
|
ChartType = SeriesChartType.Point,
|
||||||
@@ -178,8 +233,8 @@ namespace LeafWeb.WebCms.Services
|
|||||||
|
|
||||||
chart.Series.Add(new Series
|
chart.Series.Add(new Series
|
||||||
{
|
{
|
||||||
MarkerSize = 9,
|
MarkerSize = sizes.RuBPMarkerSize,
|
||||||
BorderWidth = 3,
|
BorderWidth = sizes.RuBPBorderWidth,
|
||||||
XValueType = ChartValueType.Double,
|
XValueType = ChartValueType.Double,
|
||||||
Name = "RuBP regeneration-limited",
|
Name = "RuBP regeneration-limited",
|
||||||
ChartType = SeriesChartType.Point,
|
ChartType = SeriesChartType.Point,
|
||||||
@@ -193,8 +248,8 @@ namespace LeafWeb.WebCms.Services
|
|||||||
|
|
||||||
chart.Series.Add(new Series
|
chart.Series.Add(new Series
|
||||||
{
|
{
|
||||||
MarkerSize = 2,
|
MarkerSize = sizes.aCurveMarkerSize,
|
||||||
BorderWidth = 1,
|
BorderWidth = sizes.aCurveBorderWidth,
|
||||||
XValueType = ChartValueType.Double,
|
XValueType = ChartValueType.Double,
|
||||||
Name = "acCurve",
|
Name = "acCurve",
|
||||||
ChartType = SeriesChartType.Line,
|
ChartType = SeriesChartType.Line,
|
||||||
@@ -209,8 +264,8 @@ namespace LeafWeb.WebCms.Services
|
|||||||
|
|
||||||
chart.Series.Add(new Series
|
chart.Series.Add(new Series
|
||||||
{
|
{
|
||||||
MarkerSize = 2,
|
MarkerSize = sizes.aCurveMarkerSize,
|
||||||
BorderWidth = 1,
|
BorderWidth = sizes.aCurveBorderWidth,
|
||||||
XValueType = ChartValueType.Double,
|
XValueType = ChartValueType.Double,
|
||||||
Name = "ajCurve",
|
Name = "ajCurve",
|
||||||
ChartType = SeriesChartType.Line,
|
ChartType = SeriesChartType.Line,
|
||||||
@@ -225,8 +280,8 @@ namespace LeafWeb.WebCms.Services
|
|||||||
|
|
||||||
chart.Series.Add(new Series
|
chart.Series.Add(new Series
|
||||||
{
|
{
|
||||||
MarkerSize = 2,
|
MarkerSize = sizes.aCurveMarkerSize,
|
||||||
BorderWidth = 1,
|
BorderWidth = sizes.aCurveBorderWidth,
|
||||||
XValueType = ChartValueType.Double,
|
XValueType = ChartValueType.Double,
|
||||||
Name = "atCurve",
|
Name = "atCurve",
|
||||||
ChartType = SeriesChartType.Line,
|
ChartType = SeriesChartType.Line,
|
||||||
|
|||||||
Reference in New Issue
Block a user