From f280ad796a8c431848839f3a0f0946bda38a3fac Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Tue, 20 Sep 2016 14:06:13 +0300 Subject: [PATCH 01/37] Adding layer parameters for geoms --- instat/ucrGeom.vb | 212 +++++++++++++++++++++++++++++----------------- 1 file changed, 132 insertions(+), 80 deletions(-) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 8f2c2ebacdb..5c51861eb51 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -131,32 +131,41 @@ Public Class ucrGeom Dim clsgeom_vline As New Geoms - 'clsgeom_abline.SetGeomName("geom_abline") - 'clsgeom_abline.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_abline.AddAesParameter("y", bIsMandatory:=True) - 'clsgeom_abline.AddAesParameter("alpha") - 'clsgeom_abline.AddAesParameter("colour") - 'clsgeom_abline.AddAesParameter("linetype") - 'clsgeom_abline.AddAesParameter("size") - ''aesthetics that control position of line include - ''geom_vline:xintercept - ''geom_hline:yintercept - ''geom_abline: slope and intercept - ''TO DO Discuss how to use these - 'lstAllGeoms.Add(clsgeom_abline) - - 'clsgeom_area.SetGeomName("geom_area") - ''mandatory aesthetics - 'clsgeom_area.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_area.AddAesParameter("ymax", bIsMandatory:=True) - 'clsgeom_area.AddAesParameter("ymin", bIsMandatory:=True) - ''Optional - 'clsgeom_area.AddAesParameter("alpha") - 'clsgeom_area.AddAesParameter("colour") - 'clsgeom_area.AddAesParameter("fill") - 'clsgeom_area.AddAesParameter("linetype") - 'clsgeom_area.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_area) + clsgeom_abline.SetGeomName("geom_abline") + clsgeom_abline.AddAesParameter("x", bIsMandatory:=True) + clsgeom_abline.AddAesParameter("y", bIsMandatory:=True) + clsgeom_abline.AddAesParameter("alpha") + clsgeom_abline.AddAesParameter("colour") + clsgeom_abline.AddAesParameter("linetype") + clsgeom_abline.AddAesParameter("size") + 'aesthetics that control position of line include + 'geom_vline:xintercept + 'geom_hline:yintercept + 'geom_abline: slope and intercept + 'TO DO Discuss how to use these + + 'add layer parameters + clsgeom_abline.AddLayerParameter("intercept", "numeric", "0") + clsgeom_abline.AddLayerParameter("slope", "numeric", "0") + lstAllGeoms.Add(clsgeom_abline) + + clsgeom_area.SetGeomName("geom_area") + 'mandatory aesthetics + clsgeom_area.AddAesParameter("x", bIsMandatory:=True) + clsgeom_area.AddAesParameter("ymax", bIsMandatory:=True) + clsgeom_area.AddAesParameter("ymin", bIsMandatory:=True) + 'Optional + clsgeom_area.AddAesParameter("alpha") + clsgeom_area.AddAesParameter("colour") + clsgeom_area.AddAesParameter("fill") + clsgeom_area.AddAesParameter("linetype") + clsgeom_area.AddAesParameter("size") + + 'add layer parameters + clsgeom_area.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_area.AddLayerParameter("position", "list", Chr(34) & "stack" & Chr(34)) + clsgeom_area.AddLayerParameter("na.rm", "boolean", "FALSE") + lstAllGeoms.Add(clsgeom_area) clsgeom_bar.SetGeomName("geom_bar") clsgeom_bar.AddAesParameter("x", strIncludedDataTypes:=({"factor"}), bIsMandatory:=True) @@ -176,13 +185,20 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_bar) - 'clsgeom_bin2d.SetGeomName("geom_bin2d") - ''mandatory - 'clsgeom_bin2d.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_bin2d.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_bin2d.AddAesParameter("fill") - 'lstAllGeoms.Add(clsgeom_bin2d) + clsgeom_bin2d.SetGeomName("geom_bin2d") + 'mandatory + clsgeom_bin2d.AddAesParameter("x", bIsMandatory:=True) + clsgeom_bin2d.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_bin2d.AddAesParameter("fill") + 'adding layer parameters + clsgeom_bin2d.AddLayerParameter("stat", "list", Chr(34) & "bin2d" & Chr(34)) + clsgeom_bin2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_bin2d.AddLayerParameter("na.rm", "boolean", "FALSE") + clsgeom_bin2d.AddLayerParameter("bins", "numeric", "30") + clsgeom_bin2d.AddLayerParameter("binwidth", "numeric", "0.1") + + lstAllGeoms.Add(clsgeom_bin2d) clsgeom_boxplot.SetGeomName("geom_boxplot") @@ -205,55 +221,80 @@ Public Class ucrGeom clsgeom_boxplot.AddLayerParameter("outlier.stroke ", "numeric", "0.5", lstParameterStrings:={1, 0}) lstAllGeoms.Add(clsgeom_boxplot) - 'clsgeom_contour.SetGeomName("geom_contour") - ''Mandatory - 'clsgeom_contour.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_contour.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_contour.AddAesParameter("alpha") - 'clsgeom_contour.AddAesParameter("colour") - 'clsgeom_contour.AddAesParameter("linetype") - 'clsgeom_contour.AddAesParameter("size") - 'clsgeom_contour.AddAesParameter("weight") - 'lstAllGeoms.Add(clsgeom_contour) - - 'clsgeom_count.SetGeomName("geom_count") - ''mandatory - 'clsgeom_count.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_count.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_count.AddAesParameter("alpha") - 'clsgeom_count.AddAesParameter("colour") - 'clsgeom_count.AddAesParameter("fill") - 'clsgeom_count.AddAesParameter("shape") - 'clsgeom_count.AddAesParameter("size") - 'clsgeom_count.AddAesParameter("stroke") - 'lstAllGeoms.Add(clsgeom_count) - - 'clsgeom_crossbar.strGeomName = "geom_crossbar" - ''Mandatory - 'clsgeom_crossbar.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_crossbar.AddAesParameter("ymax", bIsMandatory:=True) - 'clsgeom_crossbar.AddAesParameter("ymin", bIsMandatory:=True) - ''Optional - 'clsgeom_crossbar.AddAesParameter("alpha") - 'clsgeom_crossbar.AddAesParameter("colour") - 'clsgeom_crossbar.AddAesParameter("linetype") - 'clsgeom_crossbar.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_crossbar) + clsgeom_contour.SetGeomName("geom_contour") + 'Mandatory + clsgeom_contour.AddAesParameter("x", bIsMandatory:=True) + clsgeom_contour.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_contour.AddAesParameter("alpha") + clsgeom_contour.AddAesParameter("colour") + clsgeom_contour.AddAesParameter("linetype") + clsgeom_contour.AddAesParameter("size") + clsgeom_contour.AddAesParameter("weight") - 'clsgeom_curve.strGeomName = "geom_curve" - ''Mandatory - 'clsgeom_curve.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_curve.AddAesParameter("xend", bIsMandatory:=True) - 'clsgeom_curve.AddAesParameter("y", bIsMandatory:=True) - 'clsgeom_curve.AddAesParameter("yend", bIsMandatory:=True) + 'add layer parameters + clsgeom_contour.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + clsgeom_contour.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + 'linemitre should 1 or a number >1 + clsgeom_contour.AddLayerParameter("linemitre", "numeric", "1") + 'bin and binwidth could be added here as well. I am not sure if they are needed.... + lstAllGeoms.Add(clsgeom_contour) + + clsgeom_count.SetGeomName("geom_count") + 'mandatory + clsgeom_count.AddAesParameter("x", bIsMandatory:=True) + clsgeom_count.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_count.AddAesParameter("alpha") + clsgeom_count.AddAesParameter("colour") + clsgeom_count.AddAesParameter("fill") + clsgeom_count.AddAesParameter("shape") + clsgeom_count.AddAesParameter("size") + clsgeom_count.AddAesParameter("stroke") + + 'adding layer parameters + clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "sum" & Chr(34)) + clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_count) + + clsgeom_crossbar.strGeomName = "geom_crossbar" + 'Mandatory + clsgeom_crossbar.AddAesParameter("x", bIsMandatory:=True) + clsgeom_crossbar.AddAesParameter("ymax", bIsMandatory:=True) + clsgeom_crossbar.AddAesParameter("ymin", bIsMandatory:=True) 'Optional - 'clsgeom_curve.AddAesParameter("alpha") - 'clsgeom_curve.AddAesParameter("colour") - 'clsgeom_curve.AddAesParameter("linetype") - 'clsgeom_curve.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_curve) + clsgeom_crossbar.AddAesParameter("alpha") + clsgeom_crossbar.AddAesParameter("colour") + clsgeom_crossbar.AddAesParameter("linetype") + clsgeom_crossbar.AddAesParameter("size") + + 'adding layer parameters + clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_crossbar) + + clsgeom_curve.strGeomName = "geom_curve" + 'Mandatory + clsgeom_curve.AddAesParameter("x", bIsMandatory:=True) + clsgeom_curve.AddAesParameter("xend", bIsMandatory:=True) + clsgeom_curve.AddAesParameter("y", bIsMandatory:=True) + clsgeom_curve.AddAesParameter("yend", bIsMandatory:=True) + 'Optional + clsgeom_curve.AddAesParameter("alpha") + clsgeom_curve.AddAesParameter("colour") + clsgeom_curve.AddAesParameter("linetype") + clsgeom_curve.AddAesParameter("size") + + 'adding layer parameters + clsgeom_curve.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_curve.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_curve.AddLayerParameter("curvature", "numeric", "0.5") 'numeric values. negative values give a left hand curve while positive values give right hand curves + clsgeom_curve.AddLayerParameter("angle", "numeric", "90") 'needs to be 0-180 + clsgeom_curve.AddLayerParameter("ncp", "numeric", "5") 'more control point creates a smoother curve + clsgeom_curve.AddLayerParameter("lineend", "list", "butt", lstParameterStrings:={Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + lstAllGeoms.Add(clsgeom_curve) clsgeom_density.strGeomName = "geom_density" 'mandatory @@ -333,6 +374,9 @@ Public Class ucrGeom clsgeom_errorbar.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) clsgeom_errorbar.AddAesParameter("size", strIncludedDataTypes:={"factor"}) clsgeom_errorbar.AddAesParameter("width", strIncludedDataTypes:={"numeric"}) + 'adding layer parameters + clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_errorbar) 'clsgeom_errorbarh.strGeomName = "geom_errorbarh" @@ -457,6 +501,10 @@ Public Class ucrGeom 'clsgeom_linerange.AddAesParameter("colour") 'clsgeom_linerange.AddAesParameter("linetype") 'clsgeom_linerange.AddAesParameter("size") + + 'adding layer parameters + 'clsgeom_linerange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + ' clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) 'lstAllGeoms.Add(clsgeom_linerange) 'clsgeom_map.strGeomName = "geom_map" @@ -505,6 +553,10 @@ Public Class ucrGeom 'clsgeom_pointrange.AddAesParameter("colour") 'clsgeom_pointrange.AddAesParameter("linetype") 'clsgeom_pointrange.AddAesParameter("size") + 'adding layer parameters + 'clsgeom_pointrange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + ' clsgeom_pointrange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_pointrange) 'clsgeom_polygon.strGeomName = "geom_polygon" From 22085061918a178c8420721eafb2549bb47f0115 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Tue, 20 Sep 2016 16:26:02 +0300 Subject: [PATCH 02/37] more layer parameters for the geoms --- instat/ucrGeom.vb | 516 +++++++++++++++++++++++++++------------------- 1 file changed, 302 insertions(+), 214 deletions(-) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 5c51861eb51..5c63dfb3f40 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -58,7 +58,7 @@ Public Class ucrGeom Next SetGeomFunction(clsTempGeomFunc) If clsGeomFunction.strRCommand = Nothing OrElse cboGeomList.Items.IndexOf(clsGeomFunction.strRCommand) = -1 Then - cboGeomList.SelectedIndex = cboGeomList.Items.IndexOf("geom_boxplot") + cboGeomList.SelectedIndex = cboGeomList.Items.IndexOf("geom_abline") Else cboGeomList.SelectedIndex = cboGeomList.Items.IndexOf(clsGeomFunction.strRCommand) End If @@ -236,7 +236,7 @@ Public Class ucrGeom clsgeom_contour.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) clsgeom_contour.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + clsgeom_contour.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) 'linemitre should 1 or a number >1 clsgeom_contour.AddLayerParameter("linemitre", "numeric", "1") 'bin and binwidth could be added here as well. I am not sure if they are needed.... @@ -317,27 +317,43 @@ Public Class ucrGeom clsgeom_density.AddLayerParameter("kernel", "list", Chr(34) & "gaussian" & Chr(34), lstParameterStrings:={Chr(34) & "gaussian" & Chr(34), Chr(34) & "rectangular" & Chr(34), Chr(34) & "triangular" & Chr(34), Chr(34) & "epanechnikov" & Chr(34), Chr(34) & "biweight" & Chr(34), Chr(34) & "cosine" & Chr(34), Chr(34) & "optcosin" & Chr(34)}) lstAllGeoms.Add(clsgeom_density) - 'clsgeom_density2d.strGeomName = "geom_density2d" - ''Mandatory - 'clsgeom_density2d.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_density2d.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_density2d.AddAesParameter("alpha") - 'clsgeom_density2d.AddAesParameter("colour") - 'clsgeom_density2d.AddAesParameter("linetype") - 'clsgeom_density2d.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_density2d) + clsgeom_density2d.strGeomName = "geom_density2d" + 'Mandatory + clsgeom_density2d.AddAesParameter("x", bIsMandatory:=True) + clsgeom_density2d.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_density2d.AddAesParameter("alpha") + clsgeom_density2d.AddAesParameter("colour") + clsgeom_density2d.AddAesParameter("linetype") + clsgeom_density2d.AddAesParameter("size") + + 'Adding layer parameters + clsgeom_density2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) + clsgeom_density2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_density2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + clsgeom_density2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + 'linemitre should 1 or a number >1 + clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") + lstAllGeoms.Add(clsgeom_density2d) - 'clsgeom_density_2d.strGeomName = "geom_density_2d" - ''Mandatory - 'clsgeom_density_2d.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_density_2d.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_density_2d.AddAesParameter("alpha") - 'clsgeom_density_2d.AddAesParameter("colour") - 'clsgeom_density_2d.AddAesParameter("linetype") - 'clsgeom_density_2d.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_density_2d) + clsgeom_density_2d.strGeomName = "geom_density_2d" + 'Mandatory + clsgeom_density_2d.AddAesParameter("x", bIsMandatory:=True) + clsgeom_density_2d.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_density_2d.AddAesParameter("alpha") + clsgeom_density_2d.AddAesParameter("colour") + clsgeom_density_2d.AddAesParameter("linetype") + clsgeom_density_2d.AddAesParameter("size") + + 'Adding layer parameters + clsgeom_density_2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) + clsgeom_density_2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_density_2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + clsgeom_density_2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + 'linemitre should 1 or a number >1 + clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") + lstAllGeoms.Add(clsgeom_density_2d) clsgeom_dotplot.strGeomName = "geom_dotplot" clsgeom_dotplot.AddAesParameter("x", strIncludedDataTypes:={"factor", "numeric"}, bIsMandatory:=True) @@ -346,7 +362,6 @@ Public Class ucrGeom clsgeom_dotplot.AddAesParameter("alpha", strIncludedDataTypes:={"factor"}) clsgeom_dotplot.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) clsgeom_dotplot.AddAesParameter("fill", strIncludedDataTypes:={"factor"}) - 'adding layer parameters clsgeom_dotplot.AddLayerParameter("method", "list", Chr(34) & "dotdensity" & Chr(34), lstParameterStrings:={Chr(34) & "dotdensity" & Chr(34), Chr(34) & "histodot" & Chr(34)}) clsgeom_dotplot.AddLayerParameter("binwidth", "numeric", "1", lstParameterStrings:={1, 1}) @@ -379,19 +394,23 @@ Public Class ucrGeom clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_errorbar) - 'clsgeom_errorbarh.strGeomName = "geom_errorbarh" - ''mandatory - 'clsgeom_errorbarh.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_errorbarh.AddAesParameter("xmax", bIsMandatory:=True) - 'clsgeom_errorbarh.AddAesParameter("xmin", bIsMandatory:=True) - 'clsgeom_errorbarh.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_errorbarh.AddAesParameter("alpha") - 'clsgeom_errorbarh.AddAesParameter("colour") - 'clsgeom_errorbarh.AddAesParameter("height") - 'clsgeom_errorbarh.AddAesParameter("linetype") - 'clsgeom_errorbarh.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_errorbarh) + clsgeom_errorbarh.strGeomName = "geom_errorbarh" + 'mandatory + clsgeom_errorbarh.AddAesParameter("x", bIsMandatory:=True) + clsgeom_errorbarh.AddAesParameter("xmax", bIsMandatory:=True) + clsgeom_errorbarh.AddAesParameter("xmin", bIsMandatory:=True) + clsgeom_errorbarh.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_errorbarh.AddAesParameter("alpha") + clsgeom_errorbarh.AddAesParameter("colour") + clsgeom_errorbarh.AddAesParameter("height") + clsgeom_errorbarh.AddAesParameter("linetype") + clsgeom_errorbarh.AddAesParameter("size") + + 'add layer parameters + clsgeom_freqpoly.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_freqpoly.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_errorbarh) clsgeom_freqpoly.strGeomName = "geom_freqpoly" clsgeom_freqpoly.AddAesParameter("x", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) @@ -407,16 +426,20 @@ Public Class ucrGeom clsgeom_freqpoly.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34), Chr(34) & "stack" & Chr(34), Chr(34) & "dodge" & Chr(34)}) lstAllGeoms.Add(clsgeom_freqpoly) - 'clsgeom_hex.strGeomName = "geom_hex" - ''mandatory - 'clsgeom_hex.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_hex.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_hex.AddAesParameter("alpha") - 'clsgeom_hex.AddAesParameter("colour") - 'clsgeom_hex.AddAesParameter("fill") - 'clsgeom_hex.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_hex) + clsgeom_hex.strGeomName = "geom_hex" + 'mandatory + clsgeom_hex.AddAesParameter("x", bIsMandatory:=True) + clsgeom_hex.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_hex.AddAesParameter("alpha") + clsgeom_hex.AddAesParameter("colour") + clsgeom_hex.AddAesParameter("fill") + clsgeom_hex.AddAesParameter("size") + + 'add layer parameter + clsgeom_freqpoly.AddLayerParameter("stat", "list", Chr(34) & "binhex" & Chr(34)) + clsgeom_freqpoly.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_hex) clsgeom_histogram.strGeomName = "geom_histogram" clsgeom_histogram.AddAesParameter("x", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) @@ -447,18 +470,22 @@ Public Class ucrGeom ''TO DO Discuss how to use these 'lstAllGeoms.Add(clsgeom_hline) - 'clsgeom_jitter.strGeomName = "geom_jitter" - ''mandatory - 'clsgeom_jitter.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_jitter.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_jitter.AddAesParameter("alpha") - 'clsgeom_jitter.AddAesParameter("colour") - 'clsgeom_jitter.AddAesParameter("fill") - 'clsgeom_jitter.AddAesParameter("shape") - 'clsgeom_jitter.AddAesParameter("size") - 'clsgeom_jitter.AddAesParameter("stroke") - 'lstAllGeoms.Add(clsgeom_jitter) + clsgeom_jitter.strGeomName = "geom_jitter" + 'mandatory + clsgeom_jitter.AddAesParameter("x", bIsMandatory:=True) + clsgeom_jitter.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_jitter.AddAesParameter("alpha") + clsgeom_jitter.AddAesParameter("colour") + clsgeom_jitter.AddAesParameter("fill") + clsgeom_jitter.AddAesParameter("shape") + clsgeom_jitter.AddAesParameter("size") + clsgeom_jitter.AddAesParameter("stroke") + + 'add layer parameter + clsgeom_jitter.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_jitter.AddLayerParameter("position", "list", Chr(34) & "jitter" & Chr(34)) + lstAllGeoms.Add(clsgeom_jitter) 'clsgeom_label.strGeomName = "geom_label" ''mandatory @@ -491,21 +518,21 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_line) - 'clsgeom_linerange.strGeomName = "geom_linerange" - ''mandatory - 'clsgeom_linerange.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_linerange.AddAesParameter("ymax", bIsMandatory:=True) - 'clsgeom_linerange.AddAesParameter("ymin", bIsMandatory:=True) - ''optional - 'clsgeom_linerange.AddAesParameter("alpha") - 'clsgeom_linerange.AddAesParameter("colour") - 'clsgeom_linerange.AddAesParameter("linetype") - 'clsgeom_linerange.AddAesParameter("size") + clsgeom_linerange.strGeomName = "geom_linerange" + 'mandatory + clsgeom_linerange.AddAesParameter("x", bIsMandatory:=True) + clsgeom_linerange.AddAesParameter("ymax", bIsMandatory:=True) + clsgeom_linerange.AddAesParameter("ymin", bIsMandatory:=True) + 'optional + clsgeom_linerange.AddAesParameter("alpha") + clsgeom_linerange.AddAesParameter("colour") + clsgeom_linerange.AddAesParameter("linetype") + clsgeom_linerange.AddAesParameter("size") 'adding layer parameters - 'clsgeom_linerange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - ' clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - 'lstAllGeoms.Add(clsgeom_linerange) + clsgeom_linerange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_linerange) 'clsgeom_map.strGeomName = "geom_map" ''mandatory @@ -518,16 +545,23 @@ Public Class ucrGeom 'clsgeom_map.AddAesParameter("size") 'lstAllGeoms.Add(clsgeom_map) - 'clsgeom_path.strGeomName = "geom_path" - ''mandatory - 'clsgeom_path.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_path.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_path.AddAesParameter("alpha") - 'clsgeom_path.AddAesParameter("colour") - 'clsgeom_path.AddAesParameter("linetype") - 'clsgeom_path.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_path) + clsgeom_path.strGeomName = "geom_path" + 'mandatory + clsgeom_path.AddAesParameter("x", bIsMandatory:=True) + clsgeom_path.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_path.AddAesParameter("alpha") + clsgeom_path.AddAesParameter("colour") + clsgeom_path.AddAesParameter("linetype") + clsgeom_path.AddAesParameter("size") + 'add layer parameters + clsgeom_path.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + clsgeom_path.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_path.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + clsgeom_path.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + 'linemitre should 1 or a number >1 + clsgeom_path.AddLayerParameter("linemitre", "numeric", "1") + lstAllGeoms.Add(clsgeom_path) clsgeom_point.strGeomName = "geom_point" 'mandatory @@ -544,31 +578,34 @@ Public Class ucrGeom clsgeom_point.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34)}) lstAllGeoms.Add(clsgeom_point) - 'clsgeom_pointrange.strGeomName = "geom_pointrange" - 'clsgeom_pointrange.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_pointrange.AddAesParameter("ymax", bIsMandatory:=True) - 'clsgeom_pointrange.AddAesParameter("ymin", bIsMandatory:=True) - ''optional - 'clsgeom_pointrange.AddAesParameter("alpha") - 'clsgeom_pointrange.AddAesParameter("colour") - 'clsgeom_pointrange.AddAesParameter("linetype") - 'clsgeom_pointrange.AddAesParameter("size") + clsgeom_pointrange.strGeomName = "geom_pointrange" + clsgeom_pointrange.AddAesParameter("x", bIsMandatory:=True) + clsgeom_pointrange.AddAesParameter("ymax", bIsMandatory:=True) + clsgeom_pointrange.AddAesParameter("ymin", bIsMandatory:=True) + 'optional + clsgeom_pointrange.AddAesParameter("alpha") + clsgeom_pointrange.AddAesParameter("colour") + clsgeom_pointrange.AddAesParameter("linetype") + clsgeom_pointrange.AddAesParameter("size") 'adding layer parameters - 'clsgeom_pointrange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - ' clsgeom_pointrange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_pointrange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_pointrange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - 'lstAllGeoms.Add(clsgeom_pointrange) + lstAllGeoms.Add(clsgeom_pointrange) - 'clsgeom_polygon.strGeomName = "geom_polygon" - 'clsgeom_polygon.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_polygon.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_polygon.AddAesParameter("alpha") - 'clsgeom_polygon.AddAesParameter("colour") - 'clsgeom_polygon.AddAesParameter("fill") - 'clsgeom_polygon.AddAesParameter("linetype") - 'clsgeom_polygon.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_polygon) + clsgeom_polygon.strGeomName = "geom_polygon" + clsgeom_polygon.AddAesParameter("x", bIsMandatory:=True) + clsgeom_polygon.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_polygon.AddAesParameter("alpha") + clsgeom_polygon.AddAesParameter("colour") + clsgeom_polygon.AddAesParameter("fill") + clsgeom_polygon.AddAesParameter("linetype") + clsgeom_polygon.AddAesParameter("size") + 'add layer parameters + clsgeom_polygon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_polygon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_polygon) 'clsgeom_qq.strGeomName = "geom_qq" 'clsgeom_qq.AddAesParameter("sample", bIsMandatory:=True) @@ -577,71 +614,103 @@ Public Class ucrGeom 'clsgeom_qq.AddAesParameter("y") 'lstAllGeoms.Add(clsgeom_qq) - 'clsgeom_quantile.strGeomName = "geom_quantile" - 'clsgeom_quantile.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_quantile.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_quantile.AddAesParameter("alpha") - 'clsgeom_quantile.AddAesParameter("colour") - 'clsgeom_quantile.AddAesParameter("linetype") - 'clsgeom_quantile.AddAesParameter("size") - 'clsgeom_quantile.AddAesParameter("weight") - 'lstAllGeoms.Add(clsgeom_quantile) - - 'clsgeom_raster.strGeomName = "geom_raster" - ''mandatory - 'clsgeom_raster.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_raster.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_raster.AddAesParameter("alpha") - 'clsgeom_raster.AddAesParameter("colour") - 'clsgeom_raster.AddAesParameter("fill") - 'clsgeom_raster.AddAesParameter("linetype") - 'clsgeom_raster.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_raster) - - 'clsgeom_rect.strGeomName = "geom_rect" - ''mandatory - 'clsgeom_rect.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_rect.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_rect.AddAesParameter("alpha") - 'clsgeom_rect.AddAesParameter("colour") - 'clsgeom_rect.AddAesParameter("fill") - 'clsgeom_rect.AddAesParameter("linetype") - 'clsgeom_rect.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_rect) - - 'clsgeom_ribbon.strGeomName = "geom_ribbon" - 'clsgeom_ribbon.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_ribbon.AddAesParameter("ymax", bIsMandatory:=True) - 'clsgeom_ribbon.AddAesParameter("ymin", bIsMandatory:=True) - ''optional - 'clsgeom_ribbon.AddAesParameter("alpha") - 'clsgeom_ribbon.AddAesParameter("colour") - 'clsgeom_ribbon.AddAesParameter("linetype") - 'clsgeom_ribbon.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_ribbon) - - 'clsgeom_rug.strGeomName = "geom_rug" - 'clsgeom_rug.AddAesParameter("alpha") - 'clsgeom_rug.AddAesParameter("colour") - 'clsgeom_rug.AddAesParameter("linetype") - 'clsgeom_rug.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_rug) - - 'clsgeom_segment.strGeomName = "geom_segment" - ''mandatory - 'clsgeom_segment.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_segment.AddAesParameter("xend", bIsMandatory:=True) - 'clsgeom_segment.AddAesParameter("y", bIsMandatory:=True) - 'clsgeom_segment.AddAesParameter("yend", bIsMandatory:=True) - ''optional - 'clsgeom_segment.AddAesParameter("alpha") - 'clsgeom_segment.AddAesParameter("colour") - 'clsgeom_segment.AddAesParameter("linetype") - 'clsgeom_segment.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_segment) + clsgeom_quantile.strGeomName = "geom_quantile" + clsgeom_quantile.AddAesParameter("x", bIsMandatory:=True) + clsgeom_quantile.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_quantile.AddAesParameter("alpha") + clsgeom_quantile.AddAesParameter("colour") + clsgeom_quantile.AddAesParameter("linetype") + clsgeom_quantile.AddAesParameter("size") + clsgeom_quantile.AddAesParameter("weight") + + 'adding layer parameter + clsgeom_quantile.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + clsgeom_quantile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_quantile.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + clsgeom_quantile.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + 'linemitre should 1 or a number >1 + clsgeom_quantile.AddLayerParameter("linemitre", "numeric", "1") + lstAllGeoms.Add(clsgeom_quantile) + + clsgeom_raster.strGeomName = "geom_raster" + 'mandatory + clsgeom_raster.AddAesParameter("x", bIsMandatory:=True) + clsgeom_raster.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_raster.AddAesParameter("alpha") + clsgeom_raster.AddAesParameter("colour") + clsgeom_raster.AddAesParameter("fill") + clsgeom_raster.AddAesParameter("linetype") + clsgeom_raster.AddAesParameter("size") + + 'add layer parameter + clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_raster.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_raster.AddLayerParameter("hjust", "numeric", "0.5") + clsgeom_raster.AddLayerParameter("vjust", "numeric", "0.5") + + lstAllGeoms.Add(clsgeom_raster) + + clsgeom_rect.strGeomName = "geom_rect" + 'mandatory + clsgeom_rect.AddAesParameter("x", bIsMandatory:=True) + clsgeom_rect.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_rect.AddAesParameter("alpha") + clsgeom_rect.AddAesParameter("colour") + clsgeom_rect.AddAesParameter("fill") + clsgeom_rect.AddAesParameter("linetype") + clsgeom_rect.AddAesParameter("size") + + 'clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_rect.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_rect.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_rect) + + clsgeom_ribbon.strGeomName = "geom_ribbon" + clsgeom_ribbon.AddAesParameter("x", bIsMandatory:=True) + clsgeom_ribbon.AddAesParameter("ymax", bIsMandatory:=True) + clsgeom_ribbon.AddAesParameter("ymin", bIsMandatory:=True) + 'optional + clsgeom_ribbon.AddAesParameter("alpha") + clsgeom_ribbon.AddAesParameter("colour") + clsgeom_ribbon.AddAesParameter("linetype") + clsgeom_ribbon.AddAesParameter("size") + + 'add layer parameter + clsgeom_ribbon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_ribbon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_ribbon) + + clsgeom_rug.strGeomName = "geom_rug" + clsgeom_rug.AddAesParameter("alpha") + clsgeom_rug.AddAesParameter("colour") + clsgeom_rug.AddAesParameter("linetype") + clsgeom_rug.AddAesParameter("size") + + 'adding layer parameters + clsgeom_rug.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_rug.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_rug) + + clsgeom_segment.strGeomName = "geom_segment" + 'mandatory + clsgeom_segment.AddAesParameter("x", bIsMandatory:=True) + clsgeom_segment.AddAesParameter("xend", bIsMandatory:=True) + clsgeom_segment.AddAesParameter("y", bIsMandatory:=True) + clsgeom_segment.AddAesParameter("yend", bIsMandatory:=True) + 'optional + clsgeom_segment.AddAesParameter("alpha") + clsgeom_segment.AddAesParameter("colour") + clsgeom_segment.AddAesParameter("linetype") + clsgeom_segment.AddAesParameter("size") + 'add layer parameter + clsgeom_segment.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_segment.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_segment.AddLayerParameter("hjust", "numeric", "0.5") + clsgeom_segment.AddLayerParameter("vjust", "numeric", "0.5") + lstAllGeoms.Add(clsgeom_segment) 'clsgeom_smooth.strGeomName = "geom_smooth" ''mandatory @@ -656,28 +725,40 @@ Public Class ucrGeom 'clsgeom_smooth.AddAesParameter("weight") 'lstAllGeoms.Add(clsgeom_smooth) - 'clsgeom_spoke.strGeomName = "geom_spoke" - ''mandatory - 'clsgeom_spoke.AddAesParameter("angle", bIsMandatory:=True) - 'clsgeom_spoke.AddAesParameter("radius", bIsMandatory:=True) - 'clsgeom_spoke.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_spoke.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_spoke.AddAesParameter("alpha") - 'clsgeom_spoke.AddAesParameter("colour") - 'clsgeom_spoke.AddAesParameter("linetype") - 'clsgeom_spoke.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_spoke) - - 'clsgeom_step.strGeomName = "geom_step" - 'clsgeom_step.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_step.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_step.AddAesParameter("alpha") - 'clsgeom_step.AddAesParameter("colour") - 'clsgeom_step.AddAesParameter("linetype") - 'clsgeom_step.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_step) + clsgeom_spoke.strGeomName = "geom_spoke" + 'mandatory + clsgeom_spoke.AddAesParameter("angle", bIsMandatory:=True) + clsgeom_spoke.AddAesParameter("radius", bIsMandatory:=True) + clsgeom_spoke.AddAesParameter("x", bIsMandatory:=True) + clsgeom_spoke.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_spoke.AddAesParameter("alpha") + clsgeom_spoke.AddAesParameter("colour") + clsgeom_spoke.AddAesParameter("linetype") + clsgeom_spoke.AddAesParameter("size") + + 'add layer parameter + clsgeom_spoke.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_spoke) + + clsgeom_step.strGeomName = "geom_step" + clsgeom_step.AddAesParameter("x", bIsMandatory:=True) + clsgeom_step.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_step.AddAesParameter("alpha") + clsgeom_step.AddAesParameter("colour") + clsgeom_step.AddAesParameter("linetype") + clsgeom_step.AddAesParameter("size") + + 'adding layer parameter + clsgeom_step.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + clsgeom_step.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_step.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + clsgeom_step.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + 'linemitre should 1 or a number >1 + clsgeom_step.AddLayerParameter("linemitre", "numeric", "1") + lstAllGeoms.Add(clsgeom_step) 'clsgeom_text.strGeomName = "geom_text" ''mandatory @@ -694,30 +775,37 @@ Public Class ucrGeom ''TO DO add size and vjust this might need additon of labels and receivers 'lstAllGeoms.Add(clsgeom_text) - 'clsgeom_tile.strGeomName = "geom_tile" - ''mandatory - 'clsgeom_tile.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_tile.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_tile.AddAesParameter("alpha") - 'clsgeom_tile.AddAesParameter("colour") - 'clsgeom_tile.AddAesParameter("fill") - 'clsgeom_tile.AddAesParameter("linetype") - 'clsgeom_tile.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_tile) - - 'clsgeom_violin.strGeomName = "geom_violin" - ''mandatory - 'clsgeom_violin.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_violin.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_violin.AddAesParameter("alpha") - 'clsgeom_violin.AddAesParameter("colour") - 'clsgeom_violin.AddAesParameter("fill") - 'clsgeom_violin.AddAesParameter("linetype") - 'clsgeom_violin.AddAesParameter("size") - 'clsgeom_violin.AddAesParameter("weight") - 'lstAllGeoms.Add(clsgeom_violin) + clsgeom_tile.strGeomName = "geom_tile" + 'mandatory + clsgeom_tile.AddAesParameter("x", bIsMandatory:=True) + clsgeom_tile.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_tile.AddAesParameter("alpha") + clsgeom_tile.AddAesParameter("colour") + clsgeom_tile.AddAesParameter("fill") + clsgeom_tile.AddAesParameter("linetype") + clsgeom_tile.AddAesParameter("size") + + 'add layer parameters + clsgeom_tile.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_tile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_tile) + + clsgeom_violin.strGeomName = "geom_violin" + 'mandatory + clsgeom_violin.AddAesParameter("x", bIsMandatory:=True) + clsgeom_violin.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_violin.AddAesParameter("alpha") + clsgeom_violin.AddAesParameter("colour") + clsgeom_violin.AddAesParameter("fill") + clsgeom_violin.AddAesParameter("linetype") + clsgeom_violin.AddAesParameter("size") + clsgeom_violin.AddAesParameter("weight") + 'add layer parameter + clsgeom_spoke.AddLayerParameter("stat", "list", Chr(34) & "ydensity" & Chr(34)) + clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) + lstAllGeoms.Add(clsgeom_violin) 'clsgeom_vline.strGeomName = "geom_vline" 'clsgeom_vline.AddAesParameter("alpha") From cfb9657f56a4055c6c7bac6802cfc391216a40de Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Wed, 21 Sep 2016 11:46:04 +0300 Subject: [PATCH 03/37] Changing index of geoms to geom_boxplot --- instat/ucrGeom.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 5c63dfb3f40..c7801c592a5 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -58,7 +58,7 @@ Public Class ucrGeom Next SetGeomFunction(clsTempGeomFunc) If clsGeomFunction.strRCommand = Nothing OrElse cboGeomList.Items.IndexOf(clsGeomFunction.strRCommand) = -1 Then - cboGeomList.SelectedIndex = cboGeomList.Items.IndexOf("geom_abline") + cboGeomList.SelectedIndex = cboGeomList.Items.IndexOf("geom_boxplot") Else cboGeomList.SelectedIndex = cboGeomList.Items.IndexOf(clsGeomFunction.strRCommand) End If From 52a33a39d60fa818f9877309417570c128b4a24a Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Fri, 23 Sep 2016 09:51:41 +0300 Subject: [PATCH 04/37] Adding more layer parameters --- instat/ucrGeom.vb | 101 ++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 44 deletions(-) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index c7801c592a5..db6e6cc4815 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -143,10 +143,9 @@ Public Class ucrGeom 'geom_hline:yintercept 'geom_abline: slope and intercept 'TO DO Discuss how to use these - 'add layer parameters clsgeom_abline.AddLayerParameter("intercept", "numeric", "0") - clsgeom_abline.AddLayerParameter("slope", "numeric", "0") + clsgeom_abline.AddLayerParameter("xxxxxxxx", "numeric", "0") lstAllGeoms.Add(clsgeom_abline) clsgeom_area.SetGeomName("geom_area") @@ -458,17 +457,18 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_histogram) - 'clsgeom_hline.strGeomName = "geom_hline" - 'clsgeom_hline.AddAesParameter("alpha") - 'clsgeom_hline.AddAesParameter("colour") - 'clsgeom_hline.AddAesParameter("linetype") - 'clsgeom_hline.AddAesParameter("size") - ''aesthetics that control position of line include - ''geom_vline:xintercept - ''geom_hline:yintercept - ''geom_abline: slope and intercept - ''TO DO Discuss how to use these - 'lstAllGeoms.Add(clsgeom_hline) + clsgeom_hline.strGeomName = "geom_hline" + clsgeom_hline.AddAesParameter("alpha") + clsgeom_hline.AddAesParameter("colour") + clsgeom_hline.AddAesParameter("linetype") + clsgeom_hline.AddAesParameter("size") + 'aesthetics that control position of line include + 'geom_vline:xintercept + 'geom_hline:yintercept + 'geom_abline: slope and intercept + 'TO DO Discuss how to use these + clsgeom_hline.AddLayerParameter("yintercept", "numeric", "0") + lstAllGeoms.Add(clsgeom_hline) clsgeom_jitter.strGeomName = "geom_jitter" 'mandatory @@ -534,16 +534,19 @@ Public Class ucrGeom clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_linerange) - 'clsgeom_map.strGeomName = "geom_map" - ''mandatory - 'clsgeom_map.AddAesParameter("map_id", bIsMandatory:=True) - ''optional - 'clsgeom_map.AddAesParameter("alpha") - 'clsgeom_map.AddAesParameter("colour") - 'clsgeom_map.AddAesParameter("fill") - 'clsgeom_map.AddAesParameter("linetype") - 'clsgeom_map.AddAesParameter("size") - 'lstAllGeoms.Add(clsgeom_map) + clsgeom_map.strGeomName = "geom_map" + 'mandatory + clsgeom_map.AddAesParameter("map_id", bIsMandatory:=True) + 'optional + clsgeom_map.AddAesParameter("alpha") + clsgeom_map.AddAesParameter("colour") + clsgeom_map.AddAesParameter("fill") + clsgeom_map.AddAesParameter("linetype") + clsgeom_map.AddAesParameter("size") + + 'adding layer parameters + clsgeom_map.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + lstAllGeoms.Add(clsgeom_map) clsgeom_path.strGeomName = "geom_path" 'mandatory @@ -760,20 +763,29 @@ Public Class ucrGeom clsgeom_step.AddLayerParameter("linemitre", "numeric", "1") lstAllGeoms.Add(clsgeom_step) - 'clsgeom_text.strGeomName = "geom_text" - ''mandatory - 'clsgeom_text.AddAesParameter("label", bIsMandatory:=True) - 'clsgeom_text.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_text.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_text.AddAesParameter("alpha") - 'clsgeom_text.AddAesParameter("colour") - 'clsgeom_text.AddAesParameter("family") - 'clsgeom_text.AddAesParameter("fontface") - 'clsgeom_text.AddAesParameter("hjust") - 'clsgeom_text.AddAesParameter("lineheight") - ''TO DO add size and vjust this might need additon of labels and receivers - 'lstAllGeoms.Add(clsgeom_text) + clsgeom_text.strGeomName = "geom_text" + 'mandatory + clsgeom_text.AddAesParameter("label", bIsMandatory:=True) + clsgeom_text.AddAesParameter("x", bIsMandatory:=True) + clsgeom_text.AddAesParameter("y", bIsMandatory:=True) + 'optional + clsgeom_text.AddAesParameter("alpha") + clsgeom_text.AddAesParameter("colour") + clsgeom_text.AddAesParameter("family") + clsgeom_text.AddAesParameter("fontface") + clsgeom_text.AddAesParameter("hjust") + clsgeom_text.AddAesParameter("lineheight") + 'TO DO add size and vjust this might need additon of labels and receivers + + + 'adding layer parameters + clsgeom_text.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_text.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_text.AddLayerParameter("parse", "bolean", "FALSE") + clsgeom_text.AddLayerParameter("nudge_x", "numeric", "0") + clsgeom_text.AddLayerParameter("nudge_y", "numeric", "0") + clsgeom_text.AddLayerParameter("check_overlap", "bolean", "FALSE") + lstAllGeoms.Add(clsgeom_text) clsgeom_tile.strGeomName = "geom_tile" 'mandatory @@ -807,13 +819,14 @@ Public Class ucrGeom clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) lstAllGeoms.Add(clsgeom_violin) - 'clsgeom_vline.strGeomName = "geom_vline" - 'clsgeom_vline.AddAesParameter("alpha") - 'clsgeom_vline.AddAesParameter("colour") - 'clsgeom_vline.AddAesParameter("linetype") - 'clsgeom_vline.AddAesParameter("size") - ''TO DO include those that control position - 'lstAllGeoms.Add(clsgeom_vline) + clsgeom_vline.strGeomName = "geom_vline" + clsgeom_vline.AddAesParameter("alpha") + clsgeom_vline.AddAesParameter("colour") + clsgeom_vline.AddAesParameter("linetype") + clsgeom_vline.AddAesParameter("size") + 'TO DO include those that control position + clsgeom_vline.AddLayerParameter("xintercept", "numeric", "0") + lstAllGeoms.Add(clsgeom_vline) End Sub Public Event GeomChanged(sender As Object, e As EventArgs) Private Sub cboGeomList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboGeomList.SelectedIndexChanged From 2dea1b493a41305c3c15641258d85ed0e4c808cd Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Fri, 23 Sep 2016 10:19:42 +0300 Subject: [PATCH 05/37] Edits on layer parameters --- instat/ucrGeom.vb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index db6e6cc4815..dfbcb00d170 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -270,8 +270,8 @@ Public Class ucrGeom clsgeom_crossbar.AddAesParameter("size") 'adding layer parameters - clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_crossbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_crossbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_crossbar) clsgeom_curve.strGeomName = "geom_curve" @@ -389,8 +389,8 @@ Public Class ucrGeom clsgeom_errorbar.AddAesParameter("size", strIncludedDataTypes:={"factor"}) clsgeom_errorbar.AddAesParameter("width", strIncludedDataTypes:={"numeric"}) 'adding layer parameters - clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_errorbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_errorbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_errorbar) clsgeom_errorbarh.strGeomName = "geom_errorbarh" @@ -407,8 +407,8 @@ Public Class ucrGeom clsgeom_errorbarh.AddAesParameter("size") 'add layer parameters - clsgeom_freqpoly.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_freqpoly.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_errorbarh.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_errorbarh.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_errorbarh) clsgeom_freqpoly.strGeomName = "geom_freqpoly" @@ -436,8 +436,8 @@ Public Class ucrGeom clsgeom_hex.AddAesParameter("size") 'add layer parameter - clsgeom_freqpoly.AddLayerParameter("stat", "list", Chr(34) & "binhex" & Chr(34)) - clsgeom_freqpoly.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + clsgeom_hex.AddLayerParameter("stat", "list", Chr(34) & "binhex" & Chr(34)) + clsgeom_hex.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) lstAllGeoms.Add(clsgeom_hex) clsgeom_histogram.strGeomName = "geom_histogram" @@ -467,6 +467,7 @@ Public Class ucrGeom 'geom_hline:yintercept 'geom_abline: slope and intercept 'TO DO Discuss how to use these + 'add layer parameter clsgeom_hline.AddLayerParameter("yintercept", "numeric", "0") lstAllGeoms.Add(clsgeom_hline) @@ -512,8 +513,8 @@ Public Class ucrGeom clsgeom_line.AddAesParameter("colour", strIncludedDataTypes:={"numeric", "factor"}) clsgeom_line.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) clsgeom_line.AddAesParameter("size", strIncludedDataTypes:={"numeric, factor"}) - 'adding layer parameters + 'adding layer parameters clsgeom_line.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34), Chr(34) & "dodge" & Chr(34), Chr(34) & "stack" & Chr(34)}) 'others options are “jitter”, “dodge” And “stack” lstAllGeoms.Add(clsgeom_line) @@ -815,8 +816,8 @@ Public Class ucrGeom clsgeom_violin.AddAesParameter("size") clsgeom_violin.AddAesParameter("weight") 'add layer parameter - clsgeom_spoke.AddLayerParameter("stat", "list", Chr(34) & "ydensity" & Chr(34)) - clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) + clsgeom_violin.AddLayerParameter("stat", "list", Chr(34) & "ydensity" & Chr(34)) + clsgeom_violin.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) lstAllGeoms.Add(clsgeom_violin) clsgeom_vline.strGeomName = "geom_vline" @@ -825,6 +826,7 @@ Public Class ucrGeom clsgeom_vline.AddAesParameter("linetype") clsgeom_vline.AddAesParameter("size") 'TO DO include those that control position + 'add layer parameter clsgeom_vline.AddLayerParameter("xintercept", "numeric", "0") lstAllGeoms.Add(clsgeom_vline) End Sub From 1c6101717957ffd07b80f74bf044d85c577c1117 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Fri, 30 Sep 2016 10:33:30 +0300 Subject: [PATCH 06/37] Added more graphs to two describe variable --- instat/dlgDescribeTwoVarGraph.vb | 104 +++++++-- instat/sdgDescribeTwoVarGraph.Designer.vb | 257 +++++++++------------- instat/sdgDescribeTwoVarGraph.vb | 122 +++++----- 3 files changed, 244 insertions(+), 239 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 50ebf4ee95b..4788804e387 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -23,6 +23,8 @@ Public Class dlgDescribeTwoVarGraph Private clsRBoxAesFunction, clsRScatterAesFunction, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarDotAesFunction As New RFunction Public clsRSummaryAesFunction, clsRStatSummary, clsRSummaryPlotFacet As New RFunction Dim clsRGGBoxPlot, clsRGGBarDotPlot, clsRGGSummaryPlot As New ROperator + Dim clsRGGFrequencyPolygon, clsRGGHistogram, clsRGGDensityPlot As New ROperator + Private clsRFrequencyPolygonGeom, clsRFrequencyPolygonFacet, clsRHistogramGeom, clsRDensityPlotGeom, clsRHistogramFacet, clsRDensityPlotFacet, clsRFreqPolyAesFunction, clsRHistAesFunction, clsRDensityAesFunction As New RFunction Private bFirstLoad As Boolean = True Private Sub dlgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -93,34 +95,51 @@ Public Class dlgDescribeTwoVarGraph strSecondVarType = ucrSecondVariableReceiver.strCurrDataType If ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then ScatterLinePlot() - If sdgDescribeTwoVarGraph.rdoScatterPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) - ElseIf sdgDescribeTwoVarGraph.rdoLinePlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) - End If + Select Case sdgDescribeTwoVarGraph.ucrNumericByNumeric.GetText + Case "Scatter plot" + ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) + Case "Line plot" + ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) + Case "Scatter and line plot" + End Select ElseIf ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "factor")) Then - BoxPlot() - If sdgDescribeTwoVarGraph.rdoBoxPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBoxPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotFacet) - End If + Select Case sdgDescribeTwoVarGraph.ucrNumericByCategorical.GetText + Case "Box plot" + BoxPlot() + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBoxPlot) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotFacet) + Case "Frequency polygon" + FrequencyPolygon() + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGFrequencyPolygon) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonFacet) + Case "Histogram" + Histogram() + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGHistogram) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramFacet) + Case "Density plot" + DensityPlot() + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGDensityPlot) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotFacet) + End Select ElseIf ((strVarType = "factor") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then SummaryPlot() - If sdgDescribeTwoVarGraph.rdoSummaryPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGSummaryPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRSummaryPlotFacet) - End If + Select Case sdgDescribeTwoVarGraph.ucrCategoricalByNumeric.GetText + Case "Summary plot" + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGSummaryPlot) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRSummaryPlotFacet) + End Select ElseIf ((strVarType = "factor") And (strSecondVarType = "factor")) Then BarDotPlot() - If sdgDescribeTwoVarGraph.rdoDotPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) - ElseIf sdgDescribeTwoVarGraph.rdoBarPlot.Checked Then - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) - End If + Select Case sdgDescribeTwoVarGraph.ucrCategoricalByCategorical.GetText + Case "Dot plot" + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + Case "Bar plot" + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) + End Select End If End Sub @@ -133,6 +152,9 @@ Public Class dlgDescribeTwoVarGraph clsRScatterAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) clsRBarDotAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) clsRSummaryAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRFreqPolyAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRHistAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDensityAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) TestOkEnabled() End Sub @@ -188,4 +210,40 @@ Public Class dlgDescribeTwoVarGraph clsRGGSummaryPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) clsRGGSummaryPlot.SetParameter(False, clsRFunc:=clsRStatSummary) End Sub + + Private Sub FrequencyPolygon() + clsRGGFrequencyPolygon.SetOperation("+") + clsRFrequencyPolygonGeom.SetRCommand("geom_freqpoly") + clsRFreqPolyAesFunction.SetRCommand("aes") + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction) + clsRFreqPolyAesFunction.AddParameter("x", "value") + clsRFrequencyPolygonFacet.SetRCommand("facet_wrap") + clsRFrequencyPolygonFacet.AddParameter("", "~variable") + clsRGGFrequencyPolygon.SetParameter(True, clsRFunc:=clsRGGplotFunction) + clsRGGFrequencyPolygon.SetParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) + End Sub + + Private Sub DensityPlot() + clsRGGDensityPlot.SetOperation("+") + clsRDensityPlotGeom.SetRCommand("geom_density") + clsRDensityAesFunction.SetRCommand("aes") + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) + clsRDensityAesFunction.AddParameter("x", "value") + clsRDensityPlotFacet.SetRCommand("facet_wrap") + clsRDensityPlotFacet.AddParameter("", "~variable") + clsRGGDensityPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) + clsRGGDensityPlot.SetParameter(False, clsRFunc:=clsRDensityPlotGeom) + End Sub + + Private Sub Histogram() + clsRGGHistogram.SetOperation("+") + clsRHistogramGeom.SetRCommand("geom_histogram") + clsRHistAesFunction.SetRCommand("aes") + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction) + clsRHistAesFunction.AddParameter("x", "value") + clsRHistogramFacet.SetRCommand("facet_wrap") + clsRHistogramFacet.AddParameter("", "~variable") + clsRGGHistogram.SetParameter(True, clsRFunc:=clsRGGplotFunction) + clsRGGHistogram.SetParameter(False, clsRFunc:=clsRHistogramGeom) + End Sub End Class \ No newline at end of file diff --git a/instat/sdgDescribeTwoVarGraph.Designer.vb b/instat/sdgDescribeTwoVarGraph.Designer.vb index 173ec139e47..48afd26943b 100644 --- a/instat/sdgDescribeTwoVarGraph.Designer.vb +++ b/instat/sdgDescribeTwoVarGraph.Designer.vb @@ -23,183 +23,126 @@ Partial Class sdgDescribeTwoVarGraph _ Private Sub InitializeComponent() Me.UcrButtonsSubdialogue1 = New instat.ucrButtonsSubdialogue() - Me.grpVariateByVariate = New System.Windows.Forms.GroupBox() - Me.rdoLinePlot = New System.Windows.Forms.RadioButton() - Me.rdoScatterPlot = New System.Windows.Forms.RadioButton() - Me.grpVariateByFactor = New System.Windows.Forms.GroupBox() - Me.rdoBoxPlot = New System.Windows.Forms.RadioButton() - Me.grpFactorByVariate = New System.Windows.Forms.GroupBox() - Me.rdoSummaryPlot = New System.Windows.Forms.RadioButton() - Me.grpFactorByFactor = New System.Windows.Forms.GroupBox() - Me.rdoDotPlot = New System.Windows.Forms.RadioButton() - Me.rdoBarPlot = New System.Windows.Forms.RadioButton() - Me.grpVariateByVariate.SuspendLayout() - Me.grpVariateByFactor.SuspendLayout() - Me.grpFactorByVariate.SuspendLayout() - Me.grpFactorByFactor.SuspendLayout() + Me.ucrNumericByNumeric = New instat.ucrInputComboBox() + Me.lblNumericByNumeric = New System.Windows.Forms.Label() + Me.lblNumericByCategorical = New System.Windows.Forms.Label() + Me.ucrNumericByCategorical = New instat.ucrInputComboBox() + Me.lblCategoricalByCategorical = New System.Windows.Forms.Label() + Me.ucrCategoricalByCategorical = New instat.ucrInputComboBox() + Me.lblCategoricalByNumeric = New System.Windows.Forms.Label() + Me.ucrCategoricalByNumeric = New instat.ucrInputComboBox() Me.SuspendLayout() ' 'UcrButtonsSubdialogue1 ' - Me.UcrButtonsSubdialogue1.Location = New System.Drawing.Point(76, 219) + Me.UcrButtonsSubdialogue1.Location = New System.Drawing.Point(66, 143) Me.UcrButtonsSubdialogue1.Name = "UcrButtonsSubdialogue1" Me.UcrButtonsSubdialogue1.Size = New System.Drawing.Size(142, 30) - Me.UcrButtonsSubdialogue1.TabIndex = 0 - ' - 'grpVariateByVariate - ' - Me.grpVariateByVariate.Controls.Add(Me.rdoLinePlot) - Me.grpVariateByVariate.Controls.Add(Me.rdoScatterPlot) - Me.grpVariateByVariate.Location = New System.Drawing.Point(12, 12) - Me.grpVariateByVariate.Name = "grpVariateByVariate" - Me.grpVariateByVariate.Size = New System.Drawing.Size(260, 42) - Me.grpVariateByVariate.TabIndex = 114 - Me.grpVariateByVariate.TabStop = False - Me.grpVariateByVariate.Tag = "Variate_By_Variate" - Me.grpVariateByVariate.Text = "Variate By Variate" - ' - 'rdoLinePlot - ' - Me.rdoLinePlot.AutoSize = True - Me.rdoLinePlot.Location = New System.Drawing.Point(159, 18) - Me.rdoLinePlot.Name = "rdoLinePlot" - Me.rdoLinePlot.Size = New System.Drawing.Size(63, 17) - Me.rdoLinePlot.TabIndex = 116 - Me.rdoLinePlot.TabStop = True - Me.rdoLinePlot.Tag = "LinePlot" - Me.rdoLinePlot.Text = "LinePlot" - Me.rdoLinePlot.UseVisualStyleBackColor = True - ' - 'rdoScatterPlot - ' - Me.rdoScatterPlot.AutoSize = True - Me.rdoScatterPlot.Location = New System.Drawing.Point(14, 17) - Me.rdoScatterPlot.Name = "rdoScatterPlot" - Me.rdoScatterPlot.Size = New System.Drawing.Size(77, 17) - Me.rdoScatterPlot.TabIndex = 115 - Me.rdoScatterPlot.TabStop = True - Me.rdoScatterPlot.Tag = "ScatterPlot" - Me.rdoScatterPlot.Text = "ScatterPlot" - Me.rdoScatterPlot.UseVisualStyleBackColor = True - ' - 'grpVariateByFactor - ' - Me.grpVariateByFactor.Controls.Add(Me.rdoBoxPlot) - Me.grpVariateByFactor.Location = New System.Drawing.Point(12, 57) - Me.grpVariateByFactor.Name = "grpVariateByFactor" - Me.grpVariateByFactor.Size = New System.Drawing.Size(260, 46) - Me.grpVariateByFactor.TabIndex = 113 - Me.grpVariateByFactor.TabStop = False - Me.grpVariateByFactor.Tag = "Variate_By_Factor" - Me.grpVariateByFactor.Text = "Variate By Factor" - ' - 'rdoBoxPlot - ' - Me.rdoBoxPlot.AutoSize = True - Me.rdoBoxPlot.Location = New System.Drawing.Point(14, 23) - Me.rdoBoxPlot.Name = "rdoBoxPlot" - Me.rdoBoxPlot.Size = New System.Drawing.Size(61, 17) - Me.rdoBoxPlot.TabIndex = 117 - Me.rdoBoxPlot.TabStop = True - Me.rdoBoxPlot.Tag = "BoxPlot" - Me.rdoBoxPlot.Text = "BoxPlot" - Me.rdoBoxPlot.UseVisualStyleBackColor = True - ' - 'grpFactorByVariate - ' - Me.grpFactorByVariate.Controls.Add(Me.rdoSummaryPlot) - Me.grpFactorByVariate.Location = New System.Drawing.Point(12, 116) - Me.grpFactorByVariate.Name = "grpFactorByVariate" - Me.grpFactorByVariate.Size = New System.Drawing.Size(260, 43) - Me.grpFactorByVariate.TabIndex = 114 - Me.grpFactorByVariate.TabStop = False - Me.grpFactorByVariate.Tag = "Factor_By_Variate" - Me.grpFactorByVariate.Text = "Factor By Variate" - ' - 'rdoSummaryPlot - ' - Me.rdoSummaryPlot.AutoSize = True - Me.rdoSummaryPlot.Location = New System.Drawing.Point(14, 19) - Me.rdoSummaryPlot.Name = "rdoSummaryPlot" - Me.rdoSummaryPlot.Size = New System.Drawing.Size(86, 17) - Me.rdoSummaryPlot.TabIndex = 120 - Me.rdoSummaryPlot.TabStop = True - Me.rdoSummaryPlot.Tag = "SummaryPlot" - Me.rdoSummaryPlot.Text = "SummaryPlot" - Me.rdoSummaryPlot.UseVisualStyleBackColor = True - ' - 'grpFactorByFactor - ' - Me.grpFactorByFactor.Controls.Add(Me.rdoDotPlot) - Me.grpFactorByFactor.Controls.Add(Me.rdoBarPlot) - Me.grpFactorByFactor.Location = New System.Drawing.Point(12, 165) - Me.grpFactorByFactor.Name = "grpFactorByFactor" - Me.grpFactorByFactor.Size = New System.Drawing.Size(260, 42) - Me.grpFactorByFactor.TabIndex = 114 - Me.grpFactorByFactor.TabStop = False - Me.grpFactorByFactor.Tag = "Factor_By_Factor" - Me.grpFactorByFactor.Text = "Factor By Factor" - ' - 'rdoDotPlot - ' - Me.rdoDotPlot.AutoSize = True - Me.rdoDotPlot.Location = New System.Drawing.Point(159, 15) - Me.rdoDotPlot.Name = "rdoDotPlot" - Me.rdoDotPlot.Size = New System.Drawing.Size(60, 17) - Me.rdoDotPlot.TabIndex = 119 - Me.rdoDotPlot.TabStop = True - Me.rdoDotPlot.Tag = "DotPlot" - Me.rdoDotPlot.Text = "DotPlot" - Me.rdoDotPlot.UseVisualStyleBackColor = True - ' - 'rdoBarPlot - ' - Me.rdoBarPlot.AutoSize = True - Me.rdoBarPlot.Location = New System.Drawing.Point(14, 15) - Me.rdoBarPlot.Name = "rdoBarPlot" - Me.rdoBarPlot.Size = New System.Drawing.Size(59, 17) - Me.rdoBarPlot.TabIndex = 118 - Me.rdoBarPlot.TabStop = True - Me.rdoBarPlot.Tag = "BarPlot" - Me.rdoBarPlot.Text = "BarPlot" - Me.rdoBarPlot.UseVisualStyleBackColor = True + Me.UcrButtonsSubdialogue1.TabIndex = 8 + ' + 'ucrNumericByNumeric + ' + Me.ucrNumericByNumeric.IsReadOnly = False + Me.ucrNumericByNumeric.Location = New System.Drawing.Point(148, 11) + Me.ucrNumericByNumeric.Name = "ucrNumericByNumeric" + Me.ucrNumericByNumeric.Size = New System.Drawing.Size(144, 21) + Me.ucrNumericByNumeric.TabIndex = 1 + ' + 'lblNumericByNumeric + ' + Me.lblNumericByNumeric.AutoSize = True + Me.lblNumericByNumeric.Location = New System.Drawing.Point(9, 17) + Me.lblNumericByNumeric.Name = "lblNumericByNumeric" + Me.lblNumericByNumeric.Size = New System.Drawing.Size(102, 13) + Me.lblNumericByNumeric.TabIndex = 0 + Me.lblNumericByNumeric.Tag = "Numeric_by_Numeric" + Me.lblNumericByNumeric.Text = "Numeric by Numeric" + ' + 'lblNumericByCategorical + ' + Me.lblNumericByCategorical.AutoSize = True + Me.lblNumericByCategorical.Location = New System.Drawing.Point(9, 49) + Me.lblNumericByCategorical.Name = "lblNumericByCategorical" + Me.lblNumericByCategorical.Size = New System.Drawing.Size(116, 13) + Me.lblNumericByCategorical.TabIndex = 2 + Me.lblNumericByCategorical.Tag = "Numeric_by_Categorical" + Me.lblNumericByCategorical.Text = "Numeric by Categorical" + ' + 'ucrNumericByCategorical + ' + Me.ucrNumericByCategorical.IsReadOnly = False + Me.ucrNumericByCategorical.Location = New System.Drawing.Point(148, 43) + Me.ucrNumericByCategorical.Name = "ucrNumericByCategorical" + Me.ucrNumericByCategorical.Size = New System.Drawing.Size(144, 21) + Me.ucrNumericByCategorical.TabIndex = 3 + ' + 'lblCategoricalByCategorical + ' + Me.lblCategoricalByCategorical.AutoSize = True + Me.lblCategoricalByCategorical.Location = New System.Drawing.Point(9, 113) + Me.lblCategoricalByCategorical.Name = "lblCategoricalByCategorical" + Me.lblCategoricalByCategorical.Size = New System.Drawing.Size(130, 13) + Me.lblCategoricalByCategorical.TabIndex = 6 + Me.lblCategoricalByCategorical.Tag = "Categorical_by_Categorical" + Me.lblCategoricalByCategorical.Text = "Categorical by Categorical" + ' + 'ucrCategoricalByCategorical + ' + Me.ucrCategoricalByCategorical.IsReadOnly = False + Me.ucrCategoricalByCategorical.Location = New System.Drawing.Point(148, 107) + Me.ucrCategoricalByCategorical.Name = "ucrCategoricalByCategorical" + Me.ucrCategoricalByCategorical.Size = New System.Drawing.Size(144, 21) + Me.ucrCategoricalByCategorical.TabIndex = 7 + ' + 'lblCategoricalByNumeric + ' + Me.lblCategoricalByNumeric.AutoSize = True + Me.lblCategoricalByNumeric.Location = New System.Drawing.Point(9, 81) + Me.lblCategoricalByNumeric.Name = "lblCategoricalByNumeric" + Me.lblCategoricalByNumeric.Size = New System.Drawing.Size(116, 13) + Me.lblCategoricalByNumeric.TabIndex = 4 + Me.lblCategoricalByNumeric.Tag = "Categorical_by_Numeric" + Me.lblCategoricalByNumeric.Text = "Categorical by Numeric" + ' + 'ucrCategoricalByNumeric + ' + Me.ucrCategoricalByNumeric.IsReadOnly = False + Me.ucrCategoricalByNumeric.Location = New System.Drawing.Point(148, 75) + Me.ucrCategoricalByNumeric.Name = "ucrCategoricalByNumeric" + Me.ucrCategoricalByNumeric.Size = New System.Drawing.Size(144, 21) + Me.ucrCategoricalByNumeric.TabIndex = 5 ' 'sdgDescribeTwoVarGraph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(284, 261) - Me.Controls.Add(Me.grpFactorByFactor) - Me.Controls.Add(Me.grpFactorByVariate) - Me.Controls.Add(Me.grpVariateByVariate) - Me.Controls.Add(Me.grpVariateByFactor) + Me.ClientSize = New System.Drawing.Size(302, 177) + Me.Controls.Add(Me.lblCategoricalByCategorical) + Me.Controls.Add(Me.ucrCategoricalByCategorical) + Me.Controls.Add(Me.lblCategoricalByNumeric) + Me.Controls.Add(Me.ucrCategoricalByNumeric) + Me.Controls.Add(Me.lblNumericByCategorical) + Me.Controls.Add(Me.ucrNumericByCategorical) + Me.Controls.Add(Me.lblNumericByNumeric) + Me.Controls.Add(Me.ucrNumericByNumeric) Me.Controls.Add(Me.UcrButtonsSubdialogue1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "sdgDescribeTwoVarGraph" Me.Text = "Two Variable Graph" - Me.grpVariateByVariate.ResumeLayout(False) - Me.grpVariateByVariate.PerformLayout() - Me.grpVariateByFactor.ResumeLayout(False) - Me.grpVariateByFactor.PerformLayout() - Me.grpFactorByVariate.ResumeLayout(False) - Me.grpFactorByVariate.PerformLayout() - Me.grpFactorByFactor.ResumeLayout(False) - Me.grpFactorByFactor.PerformLayout() Me.ResumeLayout(False) + Me.PerformLayout() End Sub Friend WithEvents UcrButtonsSubdialogue1 As ucrButtonsSubdialogue - Friend WithEvents grpVariateByVariate As GroupBox - Friend WithEvents rdoLinePlot As RadioButton - Friend WithEvents rdoScatterPlot As RadioButton - Friend WithEvents grpVariateByFactor As GroupBox - Friend WithEvents rdoBoxPlot As RadioButton - Friend WithEvents grpFactorByVariate As GroupBox - Friend WithEvents rdoSummaryPlot As RadioButton - Friend WithEvents grpFactorByFactor As GroupBox - Friend WithEvents rdoDotPlot As RadioButton - Friend WithEvents rdoBarPlot As RadioButton + Friend WithEvents ucrNumericByNumeric As ucrInputComboBox + Friend WithEvents lblNumericByNumeric As Label + Friend WithEvents lblNumericByCategorical As Label + Friend WithEvents ucrNumericByCategorical As ucrInputComboBox + Friend WithEvents lblCategoricalByCategorical As Label + Friend WithEvents ucrCategoricalByCategorical As ucrInputComboBox + Friend WithEvents lblCategoricalByNumeric As Label + Friend WithEvents ucrCategoricalByNumeric As ucrInputComboBox End Class diff --git a/instat/sdgDescribeTwoVarGraph.vb b/instat/sdgDescribeTwoVarGraph.vb index 7458b73c2b0..2e9cf80a8e6 100644 --- a/instat/sdgDescribeTwoVarGraph.vb +++ b/instat/sdgDescribeTwoVarGraph.vb @@ -20,79 +20,83 @@ Public Class sdgDescribeTwoVarGraph autoTranslate(Me) If bFirstLoad Then - SetDefaults() + 'SetDefaults() bFirstLoad = False End If End Sub Public Sub SetDefaults() - grpVariateByVariate.Enabled = True - grpVariateByFactor.Enabled = True - grpFactorByVariate.Enabled = True - grpFactorByFactor.Enabled = True - rdoScatterPlot.Enabled = True - rdoLinePlot.Enabled = True - rdoBoxPlot.Enabled = True - rdoSummaryPlot.Enabled = True - rdoBarPlot.Enabled = True - rdoDotPlot.Enabled = True - rdoScatterPlot.Checked = True - rdoLinePlot.Checked = False - rdoBoxPlot.Checked = True - rdoSummaryPlot.Checked = True - rdoBarPlot.Checked = True - rdoDotPlot.Checked = False + lblNumericByNumeric.Enabled = False + ucrNumericByNumeric.Enabled = False + lblNumericByCategorical.Enabled = False + ucrNumericByCategorical.Enabled = False + lblCategoricalByNumeric.Enabled = False + ucrCategoricalByNumeric.Enabled = False + lblCategoricalByCategorical.Enabled = False + ucrCategoricalByCategorical.Enabled = False + GraphOptions() End Sub - Private Sub rdoTwoVarGraphs_CheckedChanged(sender As Object, e As EventArgs) Handles rdoBarPlot.CheckedChanged, rdoLinePlot.CheckedChanged, rdoBoxPlot.CheckedChanged, rdoSummaryPlot.CheckedChanged, rdoDotPlot.CheckedChanged, rdoScatterPlot.CheckedChanged - dlgDescribeTwoVarGraph.Results() + Private Sub GraphOptions() + ucrNumericByNumeric.cboInput.Items.Add("Scatter plot") + ucrNumericByNumeric.cboInput.Items.Add("Line plot") + ucrNumericByNumeric.cboInput.Items.Add("Scatter and line plot") + ucrNumericByNumeric.cboInput.SelectedItem = "Scatter plot" + ucrNumericByCategorical.cboInput.Items.Add("Box plot") + 'ucrNumericByCategorical.cboInput.Items.Add("Dot plot") + 'ucrNumericByCategorical.cboInput.Items.Add("Point plot") + ucrNumericByCategorical.cboInput.Items.Add("Histogram") + ucrNumericByCategorical.cboInput.Items.Add("Density plot") + ucrNumericByCategorical.cboInput.Items.Add("Frequency polygon") + ucrNumericByCategorical.cboInput.SelectedItem = "Box plot" + ucrCategoricalByNumeric.cboInput.Items.Add("Summary plot") + ucrCategoricalByNumeric.cboInput.SelectedItem = "Summary plot" + ucrCategoricalByCategorical.cboInput.Items.Add("Bar plot") + ucrCategoricalByCategorical.cboInput.Items.Add("Dot plot") + ucrCategoricalByCategorical.cboInput.SelectedItem = "Bar plot" End Sub Public Sub GrpBoxEnable() If ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then - grpVariateByVariate.Enabled = True - grpVariateByFactor.Enabled = False - grpFactorByVariate.Enabled = False - grpFactorByFactor.Enabled = False - rdoScatterPlot.Enabled = True - rdoLinePlot.Enabled = True - rdoBoxPlot.Enabled = False - rdoSummaryPlot.Enabled = False - rdoBarPlot.Enabled = False - rdoDotPlot.Enabled = False + lblNumericByNumeric.Enabled = True + ucrNumericByNumeric.Enabled = True + lblNumericByCategorical.Enabled = False + ucrNumericByCategorical.Enabled = False + lblCategoricalByNumeric.Enabled = False + ucrCategoricalByNumeric.Enabled = False + lblCategoricalByCategorical.Enabled = False + ucrCategoricalByCategorical.Enabled = False ElseIf ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then - grpVariateByVariate.Enabled = False - grpVariateByFactor.Enabled = True - grpFactorByVariate.Enabled = False - grpFactorByFactor.Enabled = False - rdoScatterPlot.Enabled = False - rdoLinePlot.Enabled = False - rdoBoxPlot.Enabled = True - rdoSummaryPlot.Enabled = False - rdoBarPlot.Enabled = False - rdoDotPlot.Enabled = False + lblNumericByNumeric.Enabled = False + ucrNumericByNumeric.Enabled = False + lblNumericByCategorical.Enabled = True + ucrNumericByCategorical.Enabled = True + lblCategoricalByNumeric.Enabled = False + ucrCategoricalByNumeric.Enabled = False + lblCategoricalByCategorical.Enabled = False + ucrCategoricalByCategorical.Enabled = False ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then - grpVariateByVariate.Enabled = False - grpVariateByFactor.Enabled = False - grpFactorByVariate.Enabled = True - grpFactorByFactor.Enabled = False - rdoScatterPlot.Enabled = False - rdoLinePlot.Enabled = False - rdoBoxPlot.Enabled = False - rdoSummaryPlot.Enabled = True - rdoBarPlot.Enabled = False - rdoDotPlot.Enabled = False + lblNumericByNumeric.Enabled = False + ucrNumericByNumeric.Enabled = False + lblNumericByCategorical.Enabled = False + ucrNumericByCategorical.Enabled = False + lblCategoricalByNumeric.Enabled = True + ucrCategoricalByNumeric.Enabled = True + lblCategoricalByCategorical.Enabled = False + ucrCategoricalByCategorical.Enabled = False ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then - grpVariateByVariate.Enabled = False - grpVariateByFactor.Enabled = False - grpFactorByVariate.Enabled = False - grpFactorByFactor.Enabled = True - rdoScatterPlot.Enabled = False - rdoLinePlot.Enabled = False - rdoBoxPlot.Enabled = False - rdoSummaryPlot.Enabled = False - rdoBarPlot.Enabled = True - rdoDotPlot.Enabled = True + lblNumericByNumeric.Enabled = False + ucrNumericByNumeric.Enabled = False + lblNumericByCategorical.Enabled = False + ucrNumericByCategorical.Enabled = False + lblCategoricalByNumeric.Enabled = False + ucrCategoricalByNumeric.Enabled = False + lblCategoricalByCategorical.Enabled = True + ucrCategoricalByCategorical.Enabled = True End If End Sub + + Private Sub ucrGraphs_NameChanged() Handles ucrNumericByNumeric.NameChanged, ucrNumericByCategorical.NameChanged, ucrCategoricalByNumeric.NameChanged, ucrCategoricalByCategorical.NameChanged + dlgDescribeTwoVarGraph.Results() + End Sub End Class \ No newline at end of file From d945f2d36e427f2ab1ea4fe9132988c34e40ad13 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 3 Oct 2016 14:22:51 +0300 Subject: [PATCH 07/37] Fixed describe two var graph dialogue and sub dialogue --- instat/dlgDescribeTwoVarGraph.Designer.vb | 26 ++++---- instat/dlgDescribeTwoVarGraph.vb | 79 +++++++---------------- instat/sdgDescribeTwoVarGraph.vb | 33 ++-------- 3 files changed, 42 insertions(+), 96 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.Designer.vb b/instat/dlgDescribeTwoVarGraph.Designer.vb index 72ec3f7ad5f..48748d8e1aa 100644 --- a/instat/dlgDescribeTwoVarGraph.Designer.vb +++ b/instat/dlgDescribeTwoVarGraph.Designer.vb @@ -24,12 +24,12 @@ Partial Class dlgDescribeTwoVarGraph Private Sub InitializeComponent() Me.cmdOptions = New System.Windows.Forms.Button() Me.lblSecondVariable = New System.Windows.Forms.Label() + Me.lblFirstVariables = New System.Windows.Forms.Label() Me.ucrReceiverMultipleTwoVar = New instat.ucrVariablesAsFactor() Me.ucrSecondVariableReceiver = New instat.ucrReceiverSingle() Me.ucrTwoVarGraphSave = New instat.ucrSaveGraph() Me.ucrSelectorTwoVarGraph = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblFirstVariables = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'cmdOptions @@ -38,8 +38,8 @@ Partial Class dlgDescribeTwoVarGraph Me.cmdOptions.Name = "cmdOptions" Me.cmdOptions.Size = New System.Drawing.Size(101, 23) Me.cmdOptions.TabIndex = 11 - Me.cmdOptions.Tag = "Options" - Me.cmdOptions.Text = "Options ..." + Me.cmdOptions.Tag = "Options..." + Me.cmdOptions.Text = "Options..." Me.cmdOptions.UseVisualStyleBackColor = True ' 'lblSecondVariable @@ -51,6 +51,16 @@ Partial Class dlgDescribeTwoVarGraph Me.lblSecondVariable.TabIndex = 14 Me.lblSecondVariable.Text = "Second Variable:" ' + 'lblFirstVariables + ' + Me.lblFirstVariables.AutoSize = True + Me.lblFirstVariables.Location = New System.Drawing.Point(307, 19) + Me.lblFirstVariables.Name = "lblFirstVariables" + Me.lblFirstVariables.Size = New System.Drawing.Size(81, 13) + Me.lblFirstVariables.TabIndex = 16 + Me.lblFirstVariables.Tag = "First_Variable(s)" + Me.lblFirstVariables.Text = "First Variable(s):" + ' 'ucrReceiverMultipleTwoVar ' Me.ucrReceiverMultipleTwoVar.Location = New System.Drawing.Point(284, 12) @@ -92,16 +102,6 @@ Partial Class dlgDescribeTwoVarGraph Me.ucrBase.Size = New System.Drawing.Size(410, 52) Me.ucrBase.TabIndex = 0 ' - 'lblFirstVariables - ' - Me.lblFirstVariables.AutoSize = True - Me.lblFirstVariables.Location = New System.Drawing.Point(307, 19) - Me.lblFirstVariables.Name = "lblFirstVariables" - Me.lblFirstVariables.Size = New System.Drawing.Size(81, 13) - Me.lblFirstVariables.TabIndex = 16 - Me.lblFirstVariables.Tag = "First_Variable(s)" - Me.lblFirstVariables.Text = "First Variable(s):" - ' 'dlgDescribeTwoVarGraph ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index 4788804e387..bbbc6ef4fe9 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -16,15 +16,10 @@ Imports instat.Translations Imports RDotNet Public Class dlgDescribeTwoVarGraph - Public strSecondVarType As String - Public strVarType As String - Private clsRGGplotFunction As New RFunction - Private clsRBoxPlotGeom, clsRBoxPlotFacet, clsRScatterPlotGeom, clsRLinePlotGeom, clsRBarDotPlotFacet As New RFunction + Public strSecondVarType, strVarType As String + Private clsRGGplotFunction, clsRBoxPlotGeom, clsRScatterPlotGeom, clsRLinePlotGeom, clsRSummaryAesFunction, clsRStatSummary, clsRFacet As New RFunction Private clsRBoxAesFunction, clsRScatterAesFunction, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarDotAesFunction As New RFunction - Public clsRSummaryAesFunction, clsRStatSummary, clsRSummaryPlotFacet As New RFunction - Dim clsRGGBoxPlot, clsRGGBarDotPlot, clsRGGSummaryPlot As New ROperator - Dim clsRGGFrequencyPolygon, clsRGGHistogram, clsRGGDensityPlot As New ROperator - Private clsRFrequencyPolygonGeom, clsRFrequencyPolygonFacet, clsRHistogramGeom, clsRDensityPlotGeom, clsRHistogramFacet, clsRDensityPlotFacet, clsRFreqPolyAesFunction, clsRHistAesFunction, clsRDensityAesFunction As New RFunction + Private clsRFrequencyPolygonGeom, clsRHistogramGeom, clsRDensityPlotGeom, clsRFreqPolyAesFunction, clsRHistAesFunction, clsRDensityAesFunction As New RFunction Private bFirstLoad As Boolean = True Private Sub dlgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -36,8 +31,6 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub SetDefaults() - clsRBoxAesFunction.ClearParameters() - clsRScatterAesFunction.ClearParameters() ucrTwoVarGraphSave.Reset() ucrSelectorTwoVarGraph.Reset() ucrSelectorTwoVarGraph.Focus() @@ -45,9 +38,14 @@ Public Class dlgDescribeTwoVarGraph TestOkEnabled() End Sub + Private Sub ucrTwoVarGraphSave_Load(sender As Object, e As EventArgs) + + End Sub + Private Sub InitialiseDialog() ucrBase.clsRsyntax.SetOperation("+") clsRGGplotFunction.SetRCommand("ggplot") + ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) ucrReceiverMultipleTwoVar.SetSelector(ucrSelectorTwoVarGraph) ucrReceiverMultipleTwoVar.SetSingleTypeStatus(True) ucrReceiverMultipleTwoVar.SetMultipleOnlyStatus(True) @@ -56,6 +54,8 @@ Public Class dlgDescribeTwoVarGraph ucrTwoVarGraphSave.strPrefix = "TwoVariableGraph" ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False ucrBase.clsRsyntax.iCallType = 0 + clsRFacet.SetRCommand("facet_wrap") + clsRFacet.AddParameter("facets", "~variable") End Sub Private Sub TestOkEnabled() @@ -95,49 +95,50 @@ Public Class dlgDescribeTwoVarGraph strSecondVarType = ucrSecondVariableReceiver.strCurrDataType If ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then ScatterLinePlot() + ucrBase.clsRsyntax.RemoveOperatorParameter("facet_wrap") Select Case sdgDescribeTwoVarGraph.ucrNumericByNumeric.GetText Case "Scatter plot" - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) Case "Line plot" - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRGGplotFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") Case "Scatter and line plot" + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) + ucrBase.clsRsyntax.AddOperatorParameter("geom_point", clsRFunc:=clsRScatterPlotGeom) End Select ElseIf ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "factor")) Then + ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") Select Case sdgDescribeTwoVarGraph.ucrNumericByCategorical.GetText Case "Box plot" BoxPlot() - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBoxPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotFacet) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotGeom) Case "Frequency polygon" FrequencyPolygon() - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGFrequencyPolygon) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonFacet) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) Case "Histogram" Histogram() - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGHistogram) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramFacet) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) Case "Density plot" DensityPlot() - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGDensityPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotFacet) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) End Select ElseIf ((strVarType = "factor") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then SummaryPlot() + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) Select Case sdgDescribeTwoVarGraph.ucrCategoricalByNumeric.GetText Case "Summary plot" - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGSummaryPlot) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRSummaryPlotFacet) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRStatSummary) End Select ElseIf ((strVarType = "factor") And (strSecondVarType = "factor")) Then BarDotPlot() + ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") + ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) Select Case sdgDescribeTwoVarGraph.ucrCategoricalByCategorical.GetText Case "Dot plot" - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) Case "Bar plot" - ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsRGGBarDotPlot) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) End Select End If @@ -163,16 +164,11 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub BoxPlot() - clsRGGBoxPlot.SetOperation("+") clsRBoxPlotGeom.SetRCommand("geom_boxplot") clsRBoxAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction) clsRBoxAesFunction.AddParameter("x", Chr(34) & "" & Chr(34)) clsRBoxAesFunction.AddParameter("y", "value") - clsRBoxPlotFacet.SetRCommand("facet_wrap") - clsRBoxPlotFacet.AddParameter("", "~variable") - clsRGGBoxPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGBoxPlot.SetParameter(False, clsRFunc:=clsRBoxPlotGeom) End Sub Private Sub ScatterLinePlot() @@ -185,65 +181,40 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub BarDotPlot() - clsRGGBarDotPlot.SetOperation("+") clsRDotPlotGeom.SetRCommand("geom_dotplot") clsRBarPlotGeom.SetRCommand("geom_bar") clsRBarDotAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarDotAesFunction) clsRBarDotAesFunction.AddParameter("fill", "value") - clsRBarDotPlotFacet.SetRCommand("facet_wrap") - clsRBarDotPlotFacet.AddParameter("", "~variable") - clsRGGBarDotPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGBarDotPlot.SetParameter(False, clsRFunc:=clsRBarDotPlotFacet) End Sub Private Sub SummaryPlot() - clsRGGSummaryPlot.SetOperation("+") clsRStatSummary.SetRCommand("stat_summary") clsRStatSummary.AddParameter("fun.y", Chr(34) & "mean" & Chr(34)) clsRStatSummary.AddParameter("geom", Chr(34) & "point" & Chr(34)) clsRSummaryAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRSummaryAesFunction) clsRSummaryAesFunction.AddParameter("x", "value") - clsRSummaryPlotFacet.SetRCommand("facet_wrap") - clsRSummaryPlotFacet.AddParameter("", "~variable") - clsRGGSummaryPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGSummaryPlot.SetParameter(False, clsRFunc:=clsRStatSummary) End Sub Private Sub FrequencyPolygon() - clsRGGFrequencyPolygon.SetOperation("+") clsRFrequencyPolygonGeom.SetRCommand("geom_freqpoly") clsRFreqPolyAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction) clsRFreqPolyAesFunction.AddParameter("x", "value") - clsRFrequencyPolygonFacet.SetRCommand("facet_wrap") - clsRFrequencyPolygonFacet.AddParameter("", "~variable") - clsRGGFrequencyPolygon.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGFrequencyPolygon.SetParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) End Sub Private Sub DensityPlot() - clsRGGDensityPlot.SetOperation("+") clsRDensityPlotGeom.SetRCommand("geom_density") clsRDensityAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) clsRDensityAesFunction.AddParameter("x", "value") - clsRDensityPlotFacet.SetRCommand("facet_wrap") - clsRDensityPlotFacet.AddParameter("", "~variable") - clsRGGDensityPlot.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGDensityPlot.SetParameter(False, clsRFunc:=clsRDensityPlotGeom) End Sub Private Sub Histogram() - clsRGGHistogram.SetOperation("+") clsRHistogramGeom.SetRCommand("geom_histogram") clsRHistAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction) clsRHistAesFunction.AddParameter("x", "value") - clsRHistogramFacet.SetRCommand("facet_wrap") - clsRHistogramFacet.AddParameter("", "~variable") - clsRGGHistogram.SetParameter(True, clsRFunc:=clsRGGplotFunction) - clsRGGHistogram.SetParameter(False, clsRFunc:=clsRHistogramGeom) End Sub End Class \ No newline at end of file diff --git a/instat/sdgDescribeTwoVarGraph.vb b/instat/sdgDescribeTwoVarGraph.vb index 2e9cf80a8e6..9954d163932 100644 --- a/instat/sdgDescribeTwoVarGraph.vb +++ b/instat/sdgDescribeTwoVarGraph.vb @@ -26,70 +26,45 @@ Public Class sdgDescribeTwoVarGraph End Sub Public Sub SetDefaults() - lblNumericByNumeric.Enabled = False ucrNumericByNumeric.Enabled = False - lblNumericByCategorical.Enabled = False ucrNumericByCategorical.Enabled = False - lblCategoricalByNumeric.Enabled = False ucrCategoricalByNumeric.Enabled = False - lblCategoricalByCategorical.Enabled = False ucrCategoricalByCategorical.Enabled = False GraphOptions() End Sub Private Sub GraphOptions() - ucrNumericByNumeric.cboInput.Items.Add("Scatter plot") - ucrNumericByNumeric.cboInput.Items.Add("Line plot") - ucrNumericByNumeric.cboInput.Items.Add("Scatter and line plot") + ucrNumericByNumeric.SetItems({"Scatter plot", "Line plot", "Scatter and line plot"}) ucrNumericByNumeric.cboInput.SelectedItem = "Scatter plot" - ucrNumericByCategorical.cboInput.Items.Add("Box plot") + ucrNumericByCategorical.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon"}) 'ucrNumericByCategorical.cboInput.Items.Add("Dot plot") 'ucrNumericByCategorical.cboInput.Items.Add("Point plot") - ucrNumericByCategorical.cboInput.Items.Add("Histogram") - ucrNumericByCategorical.cboInput.Items.Add("Density plot") - ucrNumericByCategorical.cboInput.Items.Add("Frequency polygon") ucrNumericByCategorical.cboInput.SelectedItem = "Box plot" - ucrCategoricalByNumeric.cboInput.Items.Add("Summary plot") + ucrCategoricalByNumeric.SetItems({"Summary plot"}) ucrCategoricalByNumeric.cboInput.SelectedItem = "Summary plot" - ucrCategoricalByCategorical.cboInput.Items.Add("Bar plot") - ucrCategoricalByCategorical.cboInput.Items.Add("Dot plot") + ucrCategoricalByCategorical.SetItems({"Bar plot", "Dot plot"}) ucrCategoricalByCategorical.cboInput.SelectedItem = "Bar plot" End Sub Public Sub GrpBoxEnable() If ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then - lblNumericByNumeric.Enabled = True ucrNumericByNumeric.Enabled = True - lblNumericByCategorical.Enabled = False ucrNumericByCategorical.Enabled = False - lblCategoricalByNumeric.Enabled = False ucrCategoricalByNumeric.Enabled = False - lblCategoricalByCategorical.Enabled = False ucrCategoricalByCategorical.Enabled = False ElseIf ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then - lblNumericByNumeric.Enabled = False ucrNumericByNumeric.Enabled = False - lblNumericByCategorical.Enabled = True ucrNumericByCategorical.Enabled = True - lblCategoricalByNumeric.Enabled = False ucrCategoricalByNumeric.Enabled = False - lblCategoricalByCategorical.Enabled = False ucrCategoricalByCategorical.Enabled = False ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then - lblNumericByNumeric.Enabled = False ucrNumericByNumeric.Enabled = False - lblNumericByCategorical.Enabled = False ucrNumericByCategorical.Enabled = False - lblCategoricalByNumeric.Enabled = True ucrCategoricalByNumeric.Enabled = True - lblCategoricalByCategorical.Enabled = False ucrCategoricalByCategorical.Enabled = False ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then - lblNumericByNumeric.Enabled = False ucrNumericByNumeric.Enabled = False - lblNumericByCategorical.Enabled = False ucrNumericByCategorical.Enabled = False - lblCategoricalByNumeric.Enabled = False ucrCategoricalByNumeric.Enabled = False lblCategoricalByCategorical.Enabled = True ucrCategoricalByCategorical.Enabled = True From 76f001b776dd644823feb949cbad643875ed5cc8 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Wed, 5 Oct 2016 15:02:33 +0300 Subject: [PATCH 08/37] Edited code in describe two variable graph --- instat/dlgDescribeTwoVarGraph.vb | 131 ++++++++++++++++++++++--------- instat/sdgDescribeTwoVarGraph.vb | 10 +-- 2 files changed, 98 insertions(+), 43 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index bbbc6ef4fe9..f921563a86f 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -18,8 +18,8 @@ Imports RDotNet Public Class dlgDescribeTwoVarGraph Public strSecondVarType, strVarType As String Private clsRGGplotFunction, clsRBoxPlotGeom, clsRScatterPlotGeom, clsRLinePlotGeom, clsRSummaryAesFunction, clsRStatSummary, clsRFacet As New RFunction - Private clsRBoxAesFunction, clsRScatterAesFunction, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarDotAesFunction As New RFunction - Private clsRFrequencyPolygonGeom, clsRHistogramGeom, clsRDensityPlotGeom, clsRFreqPolyAesFunction, clsRHistAesFunction, clsRDensityAesFunction As New RFunction + Private clsRBoxAesFunction, clsRBoxAesFunction2, clsRScatterAesFunction, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarAesFunction, clsRDotAesFunction, clsRDotAesFunction2 As New RFunction + Private clsRFrequencyPolygonGeom, clsRHistogramGeom, clsRDensityPlotGeom, clsRFreqPolyAesFunction, clsRFreqPolyAesFunction2, clsRHistAesFunction, clsRHistAesFunction2, clsRDensityAesFunction, clsRDensityAesFunction2 As New RFunction Private bFirstLoad As Boolean = True Private Sub dlgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -56,6 +56,7 @@ Public Class dlgDescribeTwoVarGraph ucrBase.clsRsyntax.iCallType = 0 clsRFacet.SetRCommand("facet_wrap") clsRFacet.AddParameter("facets", "~variable") + ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) End Sub Private Sub TestOkEnabled() @@ -95,7 +96,7 @@ Public Class dlgDescribeTwoVarGraph strSecondVarType = ucrSecondVariableReceiver.strCurrDataType If ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then ScatterLinePlot() - ucrBase.clsRsyntax.RemoveOperatorParameter("facet_wrap") + clsRFacet.RemoveParameterByName("scale") Select Case sdgDescribeTwoVarGraph.ucrNumericByNumeric.GetText Case "Scatter plot" ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) @@ -106,39 +107,71 @@ Public Class dlgDescribeTwoVarGraph ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) ucrBase.clsRsyntax.AddOperatorParameter("geom_point", clsRFunc:=clsRScatterPlotGeom) End Select - ElseIf ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "factor")) Then - ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) + ElseIf ((strVarType = "numeric" OrElse strVarType = "integer") And (strSecondVarType = "factor" OrElse strSecondVarType = "character" OrElse strSecondVarType = "logical")) Then + clsRFacet.RemoveParameterByName("scale") ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") Select Case sdgDescribeTwoVarGraph.ucrNumericByCategorical.GetText Case "Box plot" BoxPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotGeom) Case "Frequency polygon" FrequencyPolygon() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) Case "Histogram" Histogram() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) Case "Density plot" DensityPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) + Case "Dot plot" + clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) + DotPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + Case "Point plot" End Select - ElseIf ((strVarType = "factor") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then - SummaryPlot() + ElseIf ((strVarType = "factor" OrElse strVarType = "character" OrElse strVarType = "logical") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then + 'SummaryPlot() ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") - ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) + clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) Select Case sdgDescribeTwoVarGraph.ucrCategoricalByNumeric.GetText - Case "Summary plot" - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRStatSummary) + Case "Box plot" + BoxPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBoxPlotGeom) + Case "Frequency polygon" + FrequencyPolygon() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRFrequencyPolygonGeom) + Case "Histogram" + Histogram() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRHistogramGeom) + Case "Density plot" + DensityPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) + Case "Dot plot" + clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) + DotPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) + Case "Point plot" End Select - ElseIf ((strVarType = "factor") And (strSecondVarType = "factor")) Then - BarDotPlot() + ElseIf ((strVarType = "factor" OrElse strVarType = "character" OrElse strVarType = "logical") And (strSecondVarType = "factor" OrElse strSecondVarType = "character" OrElse strSecondVarType = "logical")) Then ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") - ucrBase.clsRsyntax.AddOperatorParameter("facet_wrap", clsRFunc:=clsRFacet) + clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) Select Case sdgDescribeTwoVarGraph.ucrCategoricalByCategorical.GetText Case "Dot plot" + DotPlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) Case "Bar plot" + BarPlot() ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRBarPlotGeom) End Select End If @@ -149,13 +182,22 @@ Public Class dlgDescribeTwoVarGraph End Sub Private Sub ucrSecondVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrSecondVariableReceiver.SelectionChanged - clsRBoxAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRScatterAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRBarDotAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRSummaryAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRFreqPolyAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRHistAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) - clsRDensityAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + If ucrSecondVariableReceiver.IsEmpty() = False Then + clsRScatterAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRBarAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) + 'clsRSummaryAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRBoxAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDotAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRFreqPolyAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRHistAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDensityAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) + + clsRBoxAesFunction2.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDotAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRFreqPolyAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRHistAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + clsRDensityAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) + End If TestOkEnabled() End Sub @@ -166,9 +208,9 @@ Public Class dlgDescribeTwoVarGraph Private Sub BoxPlot() clsRBoxPlotGeom.SetRCommand("geom_boxplot") clsRBoxAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBoxAesFunction) - clsRBoxAesFunction.AddParameter("x", Chr(34) & "" & Chr(34)) clsRBoxAesFunction.AddParameter("y", "value") + clsRBoxAesFunction2.SetRCommand("aes") + clsRBoxAesFunction2.AddParameter("x", "value") End Sub Private Sub ScatterLinePlot() @@ -177,44 +219,57 @@ Public Class dlgDescribeTwoVarGraph clsRScatterAesFunction.SetRCommand("aes") clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) clsRScatterAesFunction.AddParameter("y", "value") - clsRScatterAesFunction.AddParameter("colour", "variable") End Sub - Private Sub BarDotPlot() + + Private Sub DotPlot() clsRDotPlotGeom.SetRCommand("geom_dotplot") - clsRBarPlotGeom.SetRCommand("geom_bar") - clsRBarDotAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarDotAesFunction) - clsRBarDotAesFunction.AddParameter("fill", "value") + clsRDotPlotGeom.AddParameter("binaxis", Chr(34) & "y" & Chr(34)) + clsRDotAesFunction.SetRCommand("aes") + clsRDotAesFunction.AddParameter("x", "value") + clsRDotAesFunction2.SetRCommand("aes") + clsRDotAesFunction2.AddParameter("y", "value") End Sub - Private Sub SummaryPlot() - clsRStatSummary.SetRCommand("stat_summary") - clsRStatSummary.AddParameter("fun.y", Chr(34) & "mean" & Chr(34)) - clsRStatSummary.AddParameter("geom", Chr(34) & "point" & Chr(34)) - clsRSummaryAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRSummaryAesFunction) - clsRSummaryAesFunction.AddParameter("x", "value") + Private Sub BarPlot() + clsRBarPlotGeom.SetRCommand("geom_bar") + clsRBarPlotGeom.AddParameter("position", Chr(34) & "dodge" & Chr(34)) + clsRBarAesFunction.SetRCommand("aes") + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRBarAesFunction) + clsRBarAesFunction.AddParameter("x", "value") End Sub + 'Private Sub SummaryPlot() + ' clsRStatSummary.SetRCommand("stat_summary") + ' clsRStatSummary.AddParameter("fun.y", Chr(34) & "mean" & Chr(34)) + ' clsRStatSummary.AddParameter("geom", Chr(34) & "point" & Chr(34)) + ' clsRSummaryAesFunction.SetRCommand("aes") + ' clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRSummaryAesFunction) + ' clsRSummaryAesFunction.AddParameter("x", "value") + 'End Sub + Private Sub FrequencyPolygon() clsRFrequencyPolygonGeom.SetRCommand("geom_freqpoly") clsRFreqPolyAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRFreqPolyAesFunction) clsRFreqPolyAesFunction.AddParameter("x", "value") + clsRFreqPolyAesFunction2.SetRCommand("aes") + clsRFreqPolyAesFunction2.AddParameter("color", "value") End Sub Private Sub DensityPlot() clsRDensityPlotGeom.SetRCommand("geom_density") clsRDensityAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) clsRDensityAesFunction.AddParameter("x", "value") + clsRDensityAesFunction2.SetRCommand("aes") + clsRDensityAesFunction2.AddParameter("color", "value") End Sub Private Sub Histogram() clsRHistogramGeom.SetRCommand("geom_histogram") + clsRHistogramGeom.AddParameter("position", Chr(34) & "dodge" & Chr(34)) clsRHistAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRHistAesFunction) clsRHistAesFunction.AddParameter("x", "value") + clsRHistAesFunction2.SetRCommand("aes") + clsRHistAesFunction2.AddParameter("color", "value") End Sub End Class \ No newline at end of file diff --git a/instat/sdgDescribeTwoVarGraph.vb b/instat/sdgDescribeTwoVarGraph.vb index 9954d163932..c4faf3bb8bb 100644 --- a/instat/sdgDescribeTwoVarGraph.vb +++ b/instat/sdgDescribeTwoVarGraph.vb @@ -36,12 +36,12 @@ Public Class sdgDescribeTwoVarGraph Private Sub GraphOptions() ucrNumericByNumeric.SetItems({"Scatter plot", "Line plot", "Scatter and line plot"}) ucrNumericByNumeric.cboInput.SelectedItem = "Scatter plot" - ucrNumericByCategorical.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon"}) - 'ucrNumericByCategorical.cboInput.Items.Add("Dot plot") - 'ucrNumericByCategorical.cboInput.Items.Add("Point plot") + ucrNumericByCategorical.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon", "Dot plot", "Point plot"}) + 'How different is the point plot from the summary plot? ucrNumericByCategorical.cboInput.SelectedItem = "Box plot" - ucrCategoricalByNumeric.SetItems({"Summary plot"}) - ucrCategoricalByNumeric.cboInput.SelectedItem = "Summary plot" + 'ucrCategoricalByNumeric.SetItems({"Summary plot"}) + ucrCategoricalByNumeric.SetItems({"Box plot", "Histogram", "Density plot", "Frequency polygon", "Dot plot", "Point plot"}) + ucrCategoricalByNumeric.cboInput.SelectedItem = "Box plot" ucrCategoricalByCategorical.SetItems({"Bar plot", "Dot plot"}) ucrCategoricalByCategorical.cboInput.SelectedItem = "Bar plot" End Sub From 2a7ed5eceb94bfe253a05de2c54b509882aa9fa9 Mon Sep 17 00:00:00 2001 From: Lily Date: Fri, 7 Oct 2016 16:20:22 +0100 Subject: [PATCH 09/37] One Variable Fit Model --- instat/dlgOneVarCompareModels.vb | 2 +- instat/sdgOneVarCompareModels.vb | 29 +++++++++++---------- instat/sdgOneVarFitModDisplay.vb | 11 ++++---- instat/sdgOneVarUseModFit.vb | 43 ++++++++++++++------------------ 4 files changed, 40 insertions(+), 45 deletions(-) diff --git a/instat/dlgOneVarCompareModels.vb b/instat/dlgOneVarCompareModels.vb index aacd9972e13..b4cc3ca87a3 100644 --- a/instat/dlgOneVarCompareModels.vb +++ b/instat/dlgOneVarCompareModels.vb @@ -41,7 +41,7 @@ Public Class dlgOneVarCompareModels ucrSelectorOneVarCompModels.SetItemType("model") sdgOneVarCompareModels.SetModelFunction(ucrBase.clsRsyntax.clsBaseFunction) sdgOneVarCompareModels.SetReceiver(UcrReceiver) - sdgOneVarCompareModels.ChiSqObject() + sdgOneVarCompareModels.DisplayChiSquare() End Sub Private Sub SetDefaults() diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index 59b8187aea8..a1f36df5d6c 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -21,6 +21,7 @@ Public Class sdgOneVarCompareModels Private clsRqqcompFunction As New RFunction Private clsRppcompFunction As New RFunction Private clsListFunction As New RFunction + Private clsGetObjectOperator As New ROperator Private clsModel As New RFunction Private clsRsyntax As New RFunction Private WithEvents ucrRecs As ucrReceiver @@ -36,6 +37,7 @@ Public Class sdgOneVarCompareModels clsRdenscompFunction.SetRCommand("denscomp") clsRqqcompFunction.SetRCommand("qqcomp") clsRppcompFunction.SetRCommand("ppcomp") + clsGetObjectOperator.SetOperation("$") End Sub Public Sub SetDefaults() @@ -65,6 +67,18 @@ Public Class sdgOneVarCompareModels clsRqqcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) End Sub + Public Sub DisplayChiSquare() + If chkSaveChi.Checked Then + clsGetObjectOperator.SetOperation("$") + dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(True, "chisqtable", clsOp:=clsGetObjectOperator) + ' frmMain.clsRLink.RunScript(clsGetObjectOperator.ToScript(), 1) + End If + + + 'If our distribution is continuous, then enable the option to display chi-square + 'For continuous this is always enabled. + End Sub + Public Sub SetReceiver(ucrNewReceiver As ucrReceiver) ucrRecs = ucrNewReceiver End Sub @@ -78,10 +92,6 @@ Public Class sdgOneVarCompareModels ReturnEnabled() End Sub - Private Sub DisplayChiSquare() - 'If our distribution is continuous, then enable the option to display chi-square - 'For continuous this is always enabled. - End Sub Public Sub CreateGraphs() If Not dlgOneVarCompareModels.UcrReceiver.IsEmpty Then @@ -98,7 +108,6 @@ Public Class sdgOneVarCompareModels frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) End If End If - End Sub ' To say if our models are discrete, we cannot use Density, QQ or PP @@ -131,16 +140,6 @@ Public Class sdgOneVarCompareModels End If End Sub - Public Sub ChiSqObject() - 'instat_object$set("public", "get_from_model", Function(data_name, model_name, chisqtable, value2, value3) - - dlgOneVarCompareModels.ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$get_from_model") - dlgOneVarCompareModels.ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & dlgOneVarCompareModels.ucrSelectorOneVarCompModels.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - ' dlgOneVarCompareModels.ucrBase.clsRsyntax.AddParameter("model_name") Chr(34) & - - End Sub - - Private Sub chkSaveChi_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveChi.CheckedChanged 'dlgOneVarCompareModels.ucrBase.clsRsyntax. diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index d09945d47f0..4c22517cee1 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -44,26 +44,27 @@ Public Class sdgOneVarFitModDisplay Public Sub CreateGraphs() If rdoPlotAll.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("plot") clsRplotFunction.AddParameter("x", clsRFunctionParameter:=clsModel) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoPPPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("ppcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoCDFPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("cdfcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoQQPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("qqcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoDensityPlot.Checked Then + clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("denscomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) End If + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) End Sub Private Sub ucrDists_cboDistributionsIndexChanged(sender As Object, e As EventArgs) Handles ucrDists.cboDistributionsIndexChanged diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index 392a7585b45..e533844308a 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -17,11 +17,6 @@ Imports instat.Translations Public Class sdgOneVarUseModFit Private clsRplotFunction As New RFunction - Private clsRppFunction As New RFunction - Private clsRqqFunction As New RFunction - Private clsRdensFunction As New RFunction - Private clsRcdfFunction As New RFunction - Private clsRCIcdfFunction As New RFunction Public clsRbootFunction As New RFunction Private clsRseqFunction As New RFunction Private clsModel As New RFunction @@ -33,12 +28,6 @@ Public Class sdgOneVarUseModFit End Sub Public Sub InitialiseDialog() - clsRplotFunction.SetRCommand("plot") - clsRcdfFunction.SetRCommand("cdfcomp") - clsRppFunction.SetRCommand("ppcomp") - clsRdensFunction.SetRCommand("denscomp") - clsRqqFunction.SetRCommand("qqcomp") - clsRCIcdfFunction.SetRCommand("CIcdfplot") nudFrom.Minimum = 0 nudFrom.Maximum = 1 nudFrom.Increment = 0.05 @@ -68,26 +57,32 @@ Public Class sdgOneVarUseModFit Public Sub CreateGraphs() If rdoPlotAll.Checked Then + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("plot") clsRplotFunction.AddParameter("x", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoPPPlot.Checked Then - clsRppFunction.SetRCommand("ppcomp") - clsRppFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRppFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("ppcomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoCDFPlot.Checked Then - clsRcdfFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRcdfFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("cdfcomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoQQPlot.Checked Then - clsRqqFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRqqFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("qqcomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoDensityPlot.Checked Then - clsRdensFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) - frmMain.clsRLink.RunScript(clsRdensFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("denscomp") + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoCIcdf.Checked Then - clsRCIcdfFunction.AddParameter("b", clsRFunctionParameter:=clsRbootFunction) - clsRCIcdfFunction.AddParameter("CI.output", Chr(34) & "quantile" & Chr(34)) - frmMain.clsRLink.RunScript(clsRCIcdfFunction.ToScript(), 2) + clsRplotFunction.ClearParameters() + clsRplotFunction.SetRCommand("CIcdfplot") + clsRplotFunction.AddParameter("b", clsRFunctionParameter:=clsRbootFunction) + clsRplotFunction.AddParameter("CI.output", Chr(34) & "quantile" & Chr(34)) End If + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) End Sub Public Sub SetMyBootFunction(clsRNewBoot As RFunction) From d84c5678b85858b00c07d3f7b8e92b3785539e02 Mon Sep 17 00:00:00 2001 From: Lily Date: Sun, 9 Oct 2016 18:06:44 +0100 Subject: [PATCH 10/37] One Variable Model update --- instat/dlgOneVarCompareModels.vb | 3 +- instat/dlgOneVarFitModel.vb | 3 +- instat/dlgOneVarUseModel.vb | 2 +- instat/sdgOneVarCompareModels.vb | 16 +- instat/sdgOneVarFitModDisplay.Designer.vb | 187 ++++++++++++++++------ instat/sdgOneVarFitModDisplay.vb | 33 +++- instat/sdgOneVarFitModel.vb | 3 +- 7 files changed, 183 insertions(+), 64 deletions(-) diff --git a/instat/dlgOneVarCompareModels.vb b/instat/dlgOneVarCompareModels.vb index b4cc3ca87a3..86256d189b7 100644 --- a/instat/dlgOneVarCompareModels.vb +++ b/instat/dlgOneVarCompareModels.vb @@ -17,7 +17,6 @@ Imports instat.Translations Public Class dlgOneVarCompareModels - 'Private clsRcdfcompFunction As New RFunction Public bfirstload As Boolean = True Private Sub dlgOneVarCompareModels_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -33,7 +32,7 @@ Public Class dlgOneVarCompareModels Private Sub InitialiseDialog() sdgOneVarCompareModels.InitialiseDialog() - 'ucrBase.iHelpTopicID = + ucrBase.iHelpTopicID = 174 ucrBase.clsRsyntax.iCallType = 2 UcrReceiver.Selector = ucrSelectorOneVarCompModels UcrReceiver.SetMeAsReceiver() diff --git a/instat/dlgOneVarFitModel.vb b/instat/dlgOneVarFitModel.vb index 5490fe7c7a8..70ddf23684b 100644 --- a/instat/dlgOneVarFitModel.vb +++ b/instat/dlgOneVarFitModel.vb @@ -34,7 +34,7 @@ Public Class dlgOneVarFitModel sdgOneVarFitModDisplay.InitialiseDialog() sdgOneVarFitModel.InitialiseDialog() UcrBase.clsRsyntax.SetFunction("fitdist") - 'ucrBase.iHelpTopicID = + UcrBase.iHelpTopicID = 296 UcrBase.clsRsyntax.iCallType = 2 UcrReceiver.Selector = ucrSelectorOneVarFitMod UcrReceiver.SetMeAsReceiver() @@ -169,6 +169,7 @@ Public Class dlgOneVarFitModel Private Sub UcrBase_ClickOk(sender As Object, e As EventArgs) Handles UcrBase.ClickOk sdgOneVarFitModDisplay.CreateGraphs() + sdgOneVarFitModDisplay.LikelihoodGraphs() End Sub End Class \ No newline at end of file diff --git a/instat/dlgOneVarUseModel.vb b/instat/dlgOneVarUseModel.vb index 93a327678d6..812c2482e4b 100644 --- a/instat/dlgOneVarUseModel.vb +++ b/instat/dlgOneVarUseModel.vb @@ -34,7 +34,7 @@ Public Class dlgOneVarUseModel Private Sub InitialiseDialog() sdgOneVarUseModBootstrap.InitialiseDialog() sdgOneVarUseModFit.InitialiseDialog() - 'ucrBase.iHelpTopicID = + ucrBase.iHelpTopicID = 375 ucrBase.clsRsyntax.iCallType = 2 ucrReceiver.Selector = ucrSelector ucrReceiver.SetMeAsReceiver() diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index a1f36df5d6c..a66fdd631ec 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -37,7 +37,6 @@ Public Class sdgOneVarCompareModels clsRdenscompFunction.SetRCommand("denscomp") clsRqqcompFunction.SetRCommand("qqcomp") clsRppcompFunction.SetRCommand("ppcomp") - clsGetObjectOperator.SetOperation("$") End Sub Public Sub SetDefaults() @@ -69,12 +68,16 @@ Public Class sdgOneVarCompareModels Public Sub DisplayChiSquare() If chkSaveChi.Checked Then - clsGetObjectOperator.SetOperation("$") - dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(True, "chisqtable", clsOp:=clsGetObjectOperator) - ' frmMain.clsRLink.RunScript(clsGetObjectOperator.ToScript(), 1) - End If + dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperation("$") + dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsModel) + dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(False, strValue:="chisqtable") + + 'dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsGetObjectOperator) + 'd lgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(False, "chisqtable") + + End If 'If our distribution is continuous, then enable the option to display chi-square 'For continuous this is always enabled. End Sub @@ -107,6 +110,9 @@ Public Class sdgOneVarCompareModels If chkDensity.Checked Then frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) End If + If chkSaveChi.Checked Then + frmMain.clsRLink.RunScript(clsGetObjectOperator.ToScript(), 2) + End If End If End Sub diff --git a/instat/sdgOneVarFitModDisplay.Designer.vb b/instat/sdgOneVarFitModDisplay.Designer.vb index 4deb90f1897..84c91680f36 100644 --- a/instat/sdgOneVarFitModDisplay.Designer.vb +++ b/instat/sdgOneVarFitModDisplay.Designer.vb @@ -24,15 +24,22 @@ Partial Class sdgOneVarFitModDisplay Private Sub InitializeComponent() Me.ucrBase = New instat.ucrButtonsSubdialogue() Me.TabPage1 = New System.Windows.Forms.TabPage() - Me.rdoNoPlot = New System.Windows.Forms.RadioButton() - Me.rdoPlotAll = New System.Windows.Forms.RadioButton() - Me.rdoCDFPlot = New System.Windows.Forms.RadioButton() - Me.rdoDensityPlot = New System.Windows.Forms.RadioButton() - Me.rdoQQPlot = New System.Windows.Forms.RadioButton() Me.rdoPPPlot = New System.Windows.Forms.RadioButton() + Me.rdoQQPlot = New System.Windows.Forms.RadioButton() + Me.rdoDensityPlot = New System.Windows.Forms.RadioButton() + Me.rdoCDFPlot = New System.Windows.Forms.RadioButton() + Me.rdoPlotAll = New System.Windows.Forms.RadioButton() + Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.tbcPlots = New System.Windows.Forms.TabControl() + Me.tbclikelihood = New System.Windows.Forms.TabPage() + Me.rdoNoLik = New System.Windows.Forms.RadioButton() + Me.ucrSaveLikelihood = New instat.ucrSaveGraph() + Me.rdoLik = New System.Windows.Forms.RadioButton() + Me.rdoLoglik = New System.Windows.Forms.RadioButton() + Me.tbcSavePlots = New System.Windows.Forms.TabPage() Me.TabPage1.SuspendLayout() Me.tbcPlots.SuspendLayout() + Me.tbclikelihood.SuspendLayout() Me.SuspendLayout() ' 'ucrBase @@ -53,42 +60,30 @@ Partial Class sdgOneVarFitModDisplay Me.TabPage1.Location = New System.Drawing.Point(4, 22) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage1.Size = New System.Drawing.Size(153, 177) + Me.TabPage1.Size = New System.Drawing.Size(237, 177) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = "Plots" Me.TabPage1.UseVisualStyleBackColor = True ' - 'rdoNoPlot - ' - Me.rdoNoPlot.AutoSize = True - Me.rdoNoPlot.Checked = True - Me.rdoNoPlot.Location = New System.Drawing.Point(8, 20) - Me.rdoNoPlot.Name = "rdoNoPlot" - Me.rdoNoPlot.Size = New System.Drawing.Size(60, 17) - Me.rdoNoPlot.TabIndex = 0 - Me.rdoNoPlot.TabStop = True - Me.rdoNoPlot.Text = "No Plot" - Me.rdoNoPlot.UseVisualStyleBackColor = True - ' - 'rdoPlotAll + 'rdoPPPlot ' - Me.rdoPlotAll.AutoSize = True - Me.rdoPlotAll.Location = New System.Drawing.Point(8, 43) - Me.rdoPlotAll.Name = "rdoPlotAll" - Me.rdoPlotAll.Size = New System.Drawing.Size(68, 17) - Me.rdoPlotAll.TabIndex = 1 - Me.rdoPlotAll.Text = "Multi-Plot" - Me.rdoPlotAll.UseVisualStyleBackColor = True + Me.rdoPPPlot.AutoSize = True + Me.rdoPPPlot.Location = New System.Drawing.Point(8, 135) + Me.rdoPPPlot.Name = "rdoPPPlot" + Me.rdoPPPlot.Size = New System.Drawing.Size(60, 17) + Me.rdoPPPlot.TabIndex = 5 + Me.rdoPPPlot.Text = "PP-Plot" + Me.rdoPPPlot.UseVisualStyleBackColor = True ' - 'rdoCDFPlot + 'rdoQQPlot ' - Me.rdoCDFPlot.AutoSize = True - Me.rdoCDFPlot.Location = New System.Drawing.Point(8, 66) - Me.rdoCDFPlot.Name = "rdoCDFPlot" - Me.rdoCDFPlot.Size = New System.Drawing.Size(67, 17) - Me.rdoCDFPlot.TabIndex = 2 - Me.rdoCDFPlot.Text = "CDF Plot" - Me.rdoCDFPlot.UseVisualStyleBackColor = True + Me.rdoQQPlot.AutoSize = True + Me.rdoQQPlot.Location = New System.Drawing.Point(8, 112) + Me.rdoQQPlot.Name = "rdoQQPlot" + Me.rdoQQPlot.Size = New System.Drawing.Size(62, 17) + Me.rdoQQPlot.TabIndex = 4 + Me.rdoQQPlot.Text = "QQ-Plot" + Me.rdoQQPlot.UseVisualStyleBackColor = True ' 'rdoDensityPlot ' @@ -100,42 +95,120 @@ Partial Class sdgOneVarFitModDisplay Me.rdoDensityPlot.Text = "Density Plot" Me.rdoDensityPlot.UseVisualStyleBackColor = True ' - 'rdoQQPlot + 'rdoCDFPlot ' - Me.rdoQQPlot.AutoSize = True - Me.rdoQQPlot.Location = New System.Drawing.Point(8, 112) - Me.rdoQQPlot.Name = "rdoQQPlot" - Me.rdoQQPlot.Size = New System.Drawing.Size(62, 17) - Me.rdoQQPlot.TabIndex = 4 - Me.rdoQQPlot.Text = "QQ-Plot" - Me.rdoQQPlot.UseVisualStyleBackColor = True + Me.rdoCDFPlot.AutoSize = True + Me.rdoCDFPlot.Location = New System.Drawing.Point(8, 66) + Me.rdoCDFPlot.Name = "rdoCDFPlot" + Me.rdoCDFPlot.Size = New System.Drawing.Size(67, 17) + Me.rdoCDFPlot.TabIndex = 2 + Me.rdoCDFPlot.Text = "CDF Plot" + Me.rdoCDFPlot.UseVisualStyleBackColor = True ' - 'rdoPPPlot + 'rdoPlotAll ' - Me.rdoPPPlot.AutoSize = True - Me.rdoPPPlot.Location = New System.Drawing.Point(8, 135) - Me.rdoPPPlot.Name = "rdoPPPlot" - Me.rdoPPPlot.Size = New System.Drawing.Size(60, 17) - Me.rdoPPPlot.TabIndex = 5 - Me.rdoPPPlot.Text = "PP-Plot" - Me.rdoPPPlot.UseVisualStyleBackColor = True + Me.rdoPlotAll.AutoSize = True + Me.rdoPlotAll.Location = New System.Drawing.Point(8, 43) + Me.rdoPlotAll.Name = "rdoPlotAll" + Me.rdoPlotAll.Size = New System.Drawing.Size(68, 17) + Me.rdoPlotAll.TabIndex = 1 + Me.rdoPlotAll.Text = "Multi-Plot" + Me.rdoPlotAll.UseVisualStyleBackColor = True + ' + 'rdoNoPlot + ' + Me.rdoNoPlot.AutoSize = True + Me.rdoNoPlot.Checked = True + Me.rdoNoPlot.Location = New System.Drawing.Point(8, 20) + Me.rdoNoPlot.Name = "rdoNoPlot" + Me.rdoNoPlot.Size = New System.Drawing.Size(60, 17) + Me.rdoNoPlot.TabIndex = 0 + Me.rdoNoPlot.TabStop = True + Me.rdoNoPlot.Text = "No Plot" + Me.rdoNoPlot.UseVisualStyleBackColor = True ' 'tbcPlots ' Me.tbcPlots.Controls.Add(Me.TabPage1) + Me.tbcPlots.Controls.Add(Me.tbclikelihood) + Me.tbcPlots.Controls.Add(Me.tbcSavePlots) Me.tbcPlots.Location = New System.Drawing.Point(10, 10) Me.tbcPlots.Name = "tbcPlots" Me.tbcPlots.SelectedIndex = 0 - Me.tbcPlots.Size = New System.Drawing.Size(161, 203) + Me.tbcPlots.Size = New System.Drawing.Size(245, 203) Me.tbcPlots.TabIndex = 0 ' + 'tbclikelihood + ' + Me.tbclikelihood.Controls.Add(Me.rdoNoLik) + Me.tbclikelihood.Controls.Add(Me.ucrSaveLikelihood) + Me.tbclikelihood.Controls.Add(Me.rdoLik) + Me.tbclikelihood.Controls.Add(Me.rdoLoglik) + Me.tbclikelihood.Location = New System.Drawing.Point(4, 22) + Me.tbclikelihood.Name = "tbclikelihood" + Me.tbclikelihood.Padding = New System.Windows.Forms.Padding(3) + Me.tbclikelihood.Size = New System.Drawing.Size(237, 177) + Me.tbclikelihood.TabIndex = 1 + Me.tbclikelihood.Text = "Likelihood" + Me.tbclikelihood.UseVisualStyleBackColor = True + ' + 'rdoNoLik + ' + Me.rdoNoLik.AutoSize = True + Me.rdoNoLik.Location = New System.Drawing.Point(6, 64) + Me.rdoNoLik.Name = "rdoNoLik" + Me.rdoNoLik.Size = New System.Drawing.Size(60, 17) + Me.rdoNoLik.TabIndex = 2 + Me.rdoNoLik.TabStop = True + Me.rdoNoLik.Text = "No Plot" + Me.rdoNoLik.UseVisualStyleBackColor = True + ' + 'ucrSaveLikelihood + ' + Me.ucrSaveLikelihood.Location = New System.Drawing.Point(6, 140) + Me.ucrSaveLikelihood.Name = "ucrSaveLikelihood" + Me.ucrSaveLikelihood.Size = New System.Drawing.Size(226, 20) + Me.ucrSaveLikelihood.TabIndex = 3 + ' + 'rdoLik + ' + Me.rdoLik.AutoSize = True + Me.rdoLik.Location = New System.Drawing.Point(6, 41) + Me.rdoLik.Name = "rdoLik" + Me.rdoLik.Size = New System.Drawing.Size(94, 17) + Me.rdoLik.TabIndex = 1 + Me.rdoLik.TabStop = True + Me.rdoLik.Text = "Plot Likelihood" + Me.rdoLik.UseVisualStyleBackColor = True + ' + 'rdoLoglik + ' + Me.rdoLoglik.AutoSize = True + Me.rdoLoglik.Location = New System.Drawing.Point(6, 18) + Me.rdoLoglik.Name = "rdoLoglik" + Me.rdoLoglik.Size = New System.Drawing.Size(115, 17) + Me.rdoLoglik.TabIndex = 0 + Me.rdoLoglik.TabStop = True + Me.rdoLoglik.Text = "Plot Log-Likelihood" + Me.rdoLoglik.UseVisualStyleBackColor = True + ' + 'tbcSavePlots + ' + Me.tbcSavePlots.Location = New System.Drawing.Point(4, 22) + Me.tbcSavePlots.Name = "tbcSavePlots" + Me.tbcSavePlots.Padding = New System.Windows.Forms.Padding(3) + Me.tbcSavePlots.Size = New System.Drawing.Size(237, 177) + Me.tbcSavePlots.TabIndex = 2 + Me.tbcSavePlots.Text = "Save Plots" + Me.tbcSavePlots.UseVisualStyleBackColor = True + ' 'sdgOneVarFitModDisplay ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(176, 256) - Me.Controls.Add(Me.ucrBase) + Me.ClientSize = New System.Drawing.Size(311, 256) Me.Controls.Add(Me.tbcPlots) + Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -144,6 +217,8 @@ Partial Class sdgOneVarFitModDisplay Me.TabPage1.ResumeLayout(False) Me.TabPage1.PerformLayout() Me.tbcPlots.ResumeLayout(False) + Me.tbclikelihood.ResumeLayout(False) + Me.tbclikelihood.PerformLayout() Me.ResumeLayout(False) End Sub @@ -156,4 +231,10 @@ Partial Class sdgOneVarFitModDisplay Friend WithEvents rdoPlotAll As RadioButton Friend WithEvents rdoNoPlot As RadioButton Friend WithEvents tbcPlots As TabControl + Friend WithEvents tbclikelihood As TabPage + Friend WithEvents tbcSavePlots As TabPage + Friend WithEvents rdoNoLik As RadioButton + Friend WithEvents ucrSaveLikelihood As ucrSaveGraph + Friend WithEvents rdoLik As RadioButton + Friend WithEvents rdoLoglik As RadioButton End Class diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index 4c22517cee1..ad31068d738 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -18,6 +18,7 @@ Imports instat.Translations Public Class sdgOneVarFitModDisplay Private clsRplotFunction As New RFunction Private clsModel As New RFunction + Private clsRLogLikFunction As New RFunction Private WithEvents ucrDists As ucrDistributions Public bfirstload As Boolean = True @@ -30,6 +31,8 @@ Public Class sdgOneVarFitModDisplay Public Sub SetDefaults() rdoPlotAll.Checked = True + rdoLoglik.Checked = True + ucrSaveLikelihood.Enabled = False 'ucrBase.ihelptopicID = End Sub @@ -47,24 +50,28 @@ Public Class sdgOneVarFitModDisplay clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("plot") clsRplotFunction.AddParameter("x", clsRFunctionParameter:=clsModel) + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoPPPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("ppcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoCDFPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("cdfcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoQQPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("qqcomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) ElseIf rdoDensityPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("denscomp") clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) End If - frmMain.clsRLink.RunScript(clsRplotFunction.ToScript(), 2) End Sub Private Sub ucrDists_cboDistributionsIndexChanged(sender As Object, e As EventArgs) Handles ucrDists.cboDistributionsIndexChanged @@ -86,4 +93,28 @@ Public Class sdgOneVarFitModDisplay End If End Sub + ' looking into tab2 + + Public Sub EnableLikelihood() + If Not sdgOneVarFitModel.rdoMle.Checked Then + tbclikelihood.Enabled = False + If Not rdoNoLik.Checked Then + rdoNoLik.Checked = True + End If + Else + rdoLoglik.Checked = True + End If + End Sub + + Public Sub LikelihoodGraphs() + clsRLogLikFunction.SetRCommand("llplot") + clsRLogLikFunction.AddParameter("mlefit", clsRFunctionParameter:=clsModel) + If rdoLoglik.Checked Then + frmMain.clsRLink.RunScript(clsRLogLikFunction.ToScript(), 2) + ElseIf rdoLik.Checked Then + clsRLogLikFunction.AddParameter("loglik", strParameterValue:="FALSE") + frmMain.clsRLink.RunScript(clsRLogLikFunction.ToScript(), 2) + End If + End Sub + End Class \ No newline at end of file diff --git a/instat/sdgOneVarFitModel.vb b/instat/sdgOneVarFitModel.vb index ecb561f7d1a..c4d71b5c6d3 100644 --- a/instat/sdgOneVarFitModel.vb +++ b/instat/sdgOneVarFitModel.vb @@ -67,7 +67,7 @@ Public Class sdgOneVarFitModel End Sub - Private Sub rdoEstimators_CheckedChanged(sender As Object, e As EventArgs) Handles rdoMle.CheckedChanged, rdoMme.CheckedChanged, rdoQme.CheckedChanged, rdoMge.CheckedChanged + Public Sub rdoEstimators_CheckedChanged(sender As Object, e As EventArgs) Handles rdoMle.CheckedChanged, rdoMme.CheckedChanged, rdoQme.CheckedChanged, rdoMge.CheckedChanged If rdoMle.Checked Then clsRSyntax.AddParameter("method", Chr(34) & "mle" & Chr(34)) ElseIf rdoMme.Checked Then @@ -78,6 +78,7 @@ Public Class sdgOneVarFitModel ElseIf rdoMge.Checked Then clsRSyntax.AddParameter("method", Chr(34) & "mge" & Chr(34)) End If + 'sdgOneVarFitModDisplay.EnableLikelihood() End Sub Public Sub SetDistribution(ucrNewDists As ucrDistributions) From 7e8fdae7aa5c2f5729eaa94de36324e9c09bddae Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 10 Oct 2016 11:15:56 +0300 Subject: [PATCH 11/37] Restricting selector to numeric columns only --- instat/dlgCorrelation.vb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index e78eef7f56b..aad7ce1ade8 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -36,7 +36,6 @@ Public Class dlgCorrelation ucrReceiverMultipleColumns.Selector = ucrSelectorDataFrameVarAddRemove ucrReceiverFirstColumn.SetDataType("numeric") ucrReceiverSecondColumn.SetDataType("numeric") - ucrReceiverMultipleColumns.SetDataType("numeric") ucrBase.iHelpTopicID = 186 End Sub @@ -50,6 +49,9 @@ Public Class dlgCorrelation rdoPearson.Checked = True rdoMultipleColumns.Checked = True sdgCorrPlot.SetDefaults() + ucrReceiverMultipleColumns.SetSingleTypeStatus(True) + ucrReceiverMultipleColumns.SetDataType("numeric") + ucrReceiverMultipleColumns.SetMeAsReceiver() TestOKEnabled() End Sub From a0564ea6fe1df9dcea2967624fefeba6623d9b37 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 10 Oct 2016 12:55:42 +0300 Subject: [PATCH 12/37] Added point plot to two variablbe graphs --- instat/dlgDescribeTwoVarGraph.vb | 29 +++++++++++++---------------- instat/sdgDescribeTwoVarGraph.vb | 6 +++--- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/instat/dlgDescribeTwoVarGraph.vb b/instat/dlgDescribeTwoVarGraph.vb index f921563a86f..b74bd7646fb 100644 --- a/instat/dlgDescribeTwoVarGraph.vb +++ b/instat/dlgDescribeTwoVarGraph.vb @@ -18,7 +18,7 @@ Imports RDotNet Public Class dlgDescribeTwoVarGraph Public strSecondVarType, strVarType As String Private clsRGGplotFunction, clsRBoxPlotGeom, clsRScatterPlotGeom, clsRLinePlotGeom, clsRSummaryAesFunction, clsRStatSummary, clsRFacet As New RFunction - Private clsRBoxAesFunction, clsRBoxAesFunction2, clsRScatterAesFunction, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarAesFunction, clsRDotAesFunction, clsRDotAesFunction2 As New RFunction + Private clsRBoxAesFunction, clsRBoxAesFunction2, clsRScatterAesFunction, clsRScatterAesFunction2, clsRDotPlotGeom, clsRBarPlotGeom, clsRBarAesFunction, clsRDotAesFunction, clsRDotAesFunction2 As New RFunction Private clsRFrequencyPolygonGeom, clsRHistogramGeom, clsRDensityPlotGeom, clsRFreqPolyAesFunction, clsRFreqPolyAesFunction2, clsRHistAesFunction, clsRHistAesFunction2, clsRDensityAesFunction, clsRDensityAesFunction2 As New RFunction Private bFirstLoad As Boolean = True Private Sub dlgDescribeTwoVarGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -99,11 +99,14 @@ Public Class dlgDescribeTwoVarGraph clsRFacet.RemoveParameterByName("scale") Select Case sdgDescribeTwoVarGraph.ucrNumericByNumeric.GetText Case "Scatter plot" + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) Case "Line plot" + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") Case "Scatter and line plot" + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRLinePlotGeom) ucrBase.clsRsyntax.AddOperatorParameter("geom_point", clsRFunc:=clsRScatterPlotGeom) End Select @@ -128,14 +131,15 @@ Public Class dlgDescribeTwoVarGraph clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) Case "Dot plot" - clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) DotPlot() clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) Case "Point plot" + ScatterLinePlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) End Select ElseIf ((strVarType = "factor" OrElse strVarType = "character" OrElse strVarType = "logical") And (strSecondVarType = "numeric" OrElse strSecondVarType = "integer")) Then - 'SummaryPlot() ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) Select Case sdgDescribeTwoVarGraph.ucrCategoricalByNumeric.GetText @@ -156,11 +160,13 @@ Public Class dlgDescribeTwoVarGraph clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDensityAesFunction2) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDensityPlotGeom) Case "Dot plot" - clsRFacet.AddParameter("scale", Chr(34) & "free_x" & Chr(34)) DotPlot() clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRDotAesFunction2) ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRDotPlotGeom) Case "Point plot" + ScatterLinePlot() + clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction2) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRScatterPlotGeom) End Select ElseIf ((strVarType = "factor" OrElse strVarType = "character" OrElse strVarType = "logical") And (strSecondVarType = "factor" OrElse strSecondVarType = "character" OrElse strSecondVarType = "logical")) Then ucrBase.clsRsyntax.RemoveOperatorParameter("geom_point") @@ -185,13 +191,12 @@ Public Class dlgDescribeTwoVarGraph If ucrSecondVariableReceiver.IsEmpty() = False Then clsRScatterAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) clsRBarAesFunction.AddParameter("fill", ucrSecondVariableReceiver.GetVariableNames(False)) - 'clsRSummaryAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) clsRBoxAesFunction.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) clsRDotAesFunction.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) clsRFreqPolyAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) clsRHistAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) clsRDensityAesFunction.AddParameter("color", ucrSecondVariableReceiver.GetVariableNames(False)) - + clsRScatterAesFunction2.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) clsRBoxAesFunction2.AddParameter("y", ucrSecondVariableReceiver.GetVariableNames(False)) clsRDotAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) clsRFreqPolyAesFunction2.AddParameter("x", ucrSecondVariableReceiver.GetVariableNames(False)) @@ -217,8 +222,9 @@ Public Class dlgDescribeTwoVarGraph clsRScatterPlotGeom.SetRCommand("geom_point") clsRLinePlotGeom.SetRCommand("geom_line") clsRScatterAesFunction.SetRCommand("aes") - clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRScatterAesFunction) clsRScatterAesFunction.AddParameter("y", "value") + clsRScatterAesFunction2.SetRCommand("aes") + clsRScatterAesFunction2.AddParameter("x", "value") End Sub @@ -239,15 +245,6 @@ Public Class dlgDescribeTwoVarGraph clsRBarAesFunction.AddParameter("x", "value") End Sub - 'Private Sub SummaryPlot() - ' clsRStatSummary.SetRCommand("stat_summary") - ' clsRStatSummary.AddParameter("fun.y", Chr(34) & "mean" & Chr(34)) - ' clsRStatSummary.AddParameter("geom", Chr(34) & "point" & Chr(34)) - ' clsRSummaryAesFunction.SetRCommand("aes") - ' clsRGGplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRSummaryAesFunction) - ' clsRSummaryAesFunction.AddParameter("x", "value") - 'End Sub - Private Sub FrequencyPolygon() clsRFrequencyPolygonGeom.SetRCommand("geom_freqpoly") clsRFreqPolyAesFunction.SetRCommand("aes") diff --git a/instat/sdgDescribeTwoVarGraph.vb b/instat/sdgDescribeTwoVarGraph.vb index c4faf3bb8bb..aa15dc628a3 100644 --- a/instat/sdgDescribeTwoVarGraph.vb +++ b/instat/sdgDescribeTwoVarGraph.vb @@ -52,17 +52,17 @@ Public Class sdgDescribeTwoVarGraph ucrNumericByCategorical.Enabled = False ucrCategoricalByNumeric.Enabled = False ucrCategoricalByCategorical.Enabled = False - ElseIf ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then + ElseIf ((dlgDescribeTwoVarGraph.strVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strVarType = "integer") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "character" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "logical")) Then ucrNumericByNumeric.Enabled = False ucrNumericByCategorical.Enabled = True ucrCategoricalByNumeric.Enabled = False ucrCategoricalByCategorical.Enabled = False - ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then + ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor" OrElse dlgDescribeTwoVarGraph.strVarType = "character" OrElse dlgDescribeTwoVarGraph.strVarType = "logical") And (dlgDescribeTwoVarGraph.strSecondVarType = "numeric" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "integer")) Then ucrNumericByNumeric.Enabled = False ucrNumericByCategorical.Enabled = False ucrCategoricalByNumeric.Enabled = True ucrCategoricalByCategorical.Enabled = False - ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor")) Then + ElseIf ((dlgDescribeTwoVarGraph.strVarType = "factor" OrElse dlgDescribeTwoVarGraph.strVarType = "character" OrElse dlgDescribeTwoVarGraph.strVarType = "logical") And (dlgDescribeTwoVarGraph.strSecondVarType = "factor" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "character" OrElse dlgDescribeTwoVarGraph.strSecondVarType = "logical")) Then ucrNumericByNumeric.Enabled = False ucrNumericByCategorical.Enabled = False ucrCategoricalByNumeric.Enabled = False From 2b7dc40800d52a6114731a83ffb6a73778771562 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Mon, 10 Oct 2016 16:12:44 +0300 Subject: [PATCH 13/37] Edits --- instat/dlgCorrelation.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index aad7ce1ade8..4588df28f48 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -36,6 +36,11 @@ Public Class dlgCorrelation ucrReceiverMultipleColumns.Selector = ucrSelectorDataFrameVarAddRemove ucrReceiverFirstColumn.SetDataType("numeric") ucrReceiverSecondColumn.SetDataType("numeric") + ucrSelectorDataFrameVarAddRemove.Reset() + ucrSelectorDataFrameVarAddRemove.Focus() + ucrReceiverMultipleColumns.SetSingleTypeStatus(True) + ucrReceiverMultipleColumns.SetDataType("numeric") + ucrReceiverMultipleColumns.SetMeAsReceiver() ucrBase.iHelpTopicID = 186 End Sub @@ -44,14 +49,9 @@ Public Class dlgCorrelation End Sub Private Sub SetDefaults() - ucrSelectorDataFrameVarAddRemove.Reset() - ucrSelectorDataFrameVarAddRemove.Focus() rdoPearson.Checked = True rdoMultipleColumns.Checked = True sdgCorrPlot.SetDefaults() - ucrReceiverMultipleColumns.SetSingleTypeStatus(True) - ucrReceiverMultipleColumns.SetDataType("numeric") - ucrReceiverMultipleColumns.SetMeAsReceiver() TestOKEnabled() End Sub From abe750b1d95882ca2779fcfe3481847f7991e559 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Mon, 10 Oct 2016 17:37:09 +0300 Subject: [PATCH 14/37] Changes on the specify origin option --- instat/dlgMakeDate.vb | 227 ++++++++++++++++++++++-------------------- 1 file changed, 119 insertions(+), 108 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index d0a4e901d0b..3f071430a99 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -16,18 +16,17 @@ Imports instat.Translations Public Class dlgMakeDate - Public clsPaste As New RFunction Public bFirstLoad As Boolean = True Private Sub ucrSeclectorMakeDate_Load(sender As Object, e As EventArgs) Handles ucrSeclectorMakeDate.Load If bFirstLoad Then - InitialiseDialog() + InitialiseDialog() SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - TestOKEnabled() - autoTranslate(Me) + bFirstLoad = False + Else + ReopenDialog() + End If + TestOKEnabled() + autoTranslate(Me) End Sub @@ -42,12 +41,16 @@ Public Class dlgMakeDate ucrInputDay.SetItems({"%d (1-31)", "%j (1-366)"}) ucrInputComboBoxMonthTwo.SetItems({"365/366", "366"}) ucrInputComboBoxYearTwo.SetItems({"4 digits", "2 digits"}) - ucrInputFormat.SetItems({"%Y-%m-%d", "%Y/%m/%d", "%d%m%Y"}) + ucrInputFormat.SetItems({"%Y-%m-%d", "%d/%m/%Y", "%d%m%Y"}) ucrInputComboBoxTearThree.SetItems({"4 digits", "2 digits"}) - ucrInputOrigin.SetItems({"30-12-1899 (Excel)", "01-03-1600 (Gregorian)"}) + ucrInputOrigin.SetItems({"1899-12-30 (Excel)", "1600-03-01 (Gregorian)"}) + ucrReceiverForDate.Selector = ucrSeclectorMakeDate + ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate + ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate + ucrReceiverYearThree.Selector = ucrSeclectorMakeDate + ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate + ucrReceiverDayThree.Selector = ucrSeclectorMakeDate - ucrBase.clsRsyntax.SetFunction("as.Date") - ucrBase.clsRsyntax.AddParameter("x") End Sub Private Sub SetDefaults() @@ -56,7 +59,7 @@ Public Class dlgMakeDate ucrInputNewColumnName.Reset() ucrSeclectorMakeDate.Reset() ucrInputFormat.Reset() - ucrInputFormat.SetName("%Y-%m-%d") + ucrInputFormat.SetName("%d/%m/%Y") ucrInputSeparator.SetName("/") ucrInputYear.SetName("%Y (4 digits)") ucrInputMonth.SetName("%m (1-12)") @@ -64,13 +67,12 @@ Public Class dlgMakeDate ucrInputComboBoxTearThree.SetName("4 digits (eg 1920)") ucrInputComboBoxMonthTwo.SetName("365/366") ucrInputComboBoxYearTwo.SetName("4 digits (eg 1920)") - ucrInputOrigin.SetName("30-12-1899 (Excel)") + ucrInputOrigin.SetName("1899-12-30 (Excel)") grpFormatField.Visible = False ucrInputOrigin.Visible = False ucrInputNewColumnName.SetPrefix("Date") TestOKEnabled() rdoSingleColumn.Checked = True - ShowGroups() End Sub Private Sub TestOKEnabled() If ((Not ucrReceiverForDate.IsEmpty) OrElse ((Not ucrReceiverYearTwo.IsEmpty) AndAlso (Not ucrReceiverDayTwo.IsEmpty)) OrElse ((Not ucrReceiverDayThree.IsEmpty) AndAlso (Not ucrReceiverMonthThree.IsEmpty) AndAlso (Not ucrReceiverYearThree.IsEmpty))) Then @@ -98,88 +100,18 @@ Public Class dlgMakeDate Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged - DateCols() + Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged, ucrReceiverDayThree.SelectionChanged, ucrReceiverDayTwo.SelectionChanged, ucrReceiverMonthThree.SelectionChanged, ucrReceiverYearThree.SelectionChanged, ucrReceiverYearTwo.SelectionChanged + Formats() TestOKEnabled() End Sub - Private Sub DateCols() - If rdoSingleColumn.Checked Then - If Not ucrReceiverForDate.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) - - Else - ucrBase.clsRsyntax.RemoveParameter("x") - End If - ElseIf rdoYearandDayofYear.Checked Then - - Else - - If Not ucrReceiverMonthThree.IsEmpty AndAlso Not ucrReceiverDayThree.IsEmpty AndAlso Not ucrReceiverYearThree.IsEmpty Then - - clsPaste.SetRCommand("paste") - clsPaste.AddParameter("sep", Chr(34) & "" & Chr(34)) - clsPaste.AddParameter("x") - End If - End If - End Sub - - Private Sub ucrReceiverForDate_Load(sender As Object, e As EventArgs) - - End Sub - - Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged - ShowGroups() - End Sub - - Private Sub ShowGroups() - If rdoSingleColumn.Checked Then - ucrReceiverForDate.Selector = ucrSeclectorMakeDate - ucrReceiverForDate.SetMeAsReceiver() - grpSingleColumn.Visible = True - grpTwoColumns.Visible = False - grpThreeColumns.Visible = False - ElseIf rdoYearandDayofYear.Checked Then - ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate - ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate - ucrReceiverYearTwo.SetMeAsReceiver() - grpTwoColumns.Visible = True - grpThreeColumns.Visible = False - grpSingleColumn.Visible = False - Else - ucrReceiverYearThree.Selector = ucrSeclectorMakeDate - ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate - ucrReceiverDayThree.Selector = ucrSeclectorMakeDate - ucrReceiverYearThree.SetMeAsReceiver() - grpThreeColumns.Visible = True - grpTwoColumns.Visible = False - grpSingleColumn.Visible = False - End If - End Sub - Private Sub ShowOrigin() - If rdoSpecifyOrigin.Checked Then - ucrInputOrigin.Visible = True - Else - ucrInputOrigin.Visible = False - End If - End Sub - - Private Sub showFormat() - If chkMore.Checked Then - grpFormatField.Visible = True - Else - grpFormatField.Visible = False - End If - End Sub - - Private Sub rdoSpecifyOrigin_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged - ShowOrigin() + Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged, rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged, rdoDefaultFormat.CheckedChanged Formats() + TestOKEnabled() End Sub - Private Sub chkMore_CheckedChanged(sender As Object, e As EventArgs) Handles chkMore.CheckedChanged - showFormat() + Formats() End Sub Private Sub ucrInputSpecifyDates_NameChanged() Handles ucrInputFormat.NameChanged @@ -187,7 +119,7 @@ Public Class dlgMakeDate End Sub Private Sub ucrSeclectorMakeDate_DataFrameChanged() Handles ucrSeclectorMakeDate.DataFrameChanged - + Formats() End Sub @@ -196,32 +128,111 @@ Public Class dlgMakeDate End Sub Private Sub Formats() - If rdoSpecifyOrigin.Checked Then - ucrInputFormat.Visible = False - ucrBase.clsRsyntax.RemoveParameter("format") - If Not ucrInputOrigin.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & ucrInputOrigin.GetText & Chr(34)) + If rdoSingleColumn.Checked Then + + ucrReceiverForDate.SetMeAsReceiver() + grpSingleColumn.Visible = True + grpTwoColumns.Visible = False + grpThreeColumns.Visible = False + ucrBase.clsRsyntax.SetFunction("as.Date") + If chkMore.Checked Then + grpFormatField.Visible = True Else - ucrBase.clsRsyntax.RemoveParameter("origin") + grpFormatField.Visible = False + End If + If Not ucrReceiverForDate.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) + Else + ucrBase.clsRsyntax.RemoveParameter("x") End If - ElseIf rdoSpecifyFormat.Checked Then - ucrBase.clsRsyntax.RemoveParameter("origin") - ucrInputFormat.Visible = True - If Not ucrInputFormat.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) + If rdoSpecifyOrigin.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) + ucrInputFormat.Visible = False + ucrInputOrigin.Visible = True + ucrBase.clsRsyntax.RemoveParameter("format") + If Not ucrInputOrigin.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & ucrInputOrigin.GetText & Chr(34)) + Else + ucrBase.clsRsyntax.RemoveParameter("origin") + + + End If + ElseIf rdoSpecifyFormat.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) + + ucrBase.clsRsyntax.RemoveParameter("origin") + ucrInputFormat.Visible = True + ucrInputOrigin.Visible = False + + If Not ucrInputFormat.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) + Else + ucrBase.clsRsyntax.RemoveParameter("format") + End If Else + ucrInputOrigin.Visible = False + ucrInputFormat.Visible = False + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) ucrBase.clsRsyntax.RemoveParameter("format") + ucrBase.clsRsyntax.RemoveParameter("origin") + End If + ucrBase.clsRsyntax.RemoveParameter("year") + ucrBase.clsRsyntax.RemoveParameter("doy") + ucrBase.clsRsyntax.RemoveParameter("month") + ucrBase.clsRsyntax.RemoveParameter("day") + ucrBase.clsRsyntax.RemoveParameter("data_name") + ElseIf rdoYearandDayofYear.Checked Then + ucrReceiverYearTwo.SetMeAsReceiver() + ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + ucrBase.clsRsyntax.RemoveParameter("x") + ucrBase.clsRsyntax.RemoveParameter("format") + ucrBase.clsRsyntax.RemoveParameter("origin") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yeardoy") + grpTwoColumns.Visible = True + grpThreeColumns.Visible = False + grpSingleColumn.Visible = False + + If ucrReceiverYearTwo.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearTwo.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("year") + End If + If ucrReceiverDayTwo.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("doy", ucrReceiverDayTwo.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("doy") End If + ucrBase.clsRsyntax.RemoveParameter("month") + ucrBase.clsRsyntax.RemoveParameter("day") Else - ucrInputFormat.Visible = False + ucrReceiverYearThree.SetMeAsReceiver() + ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) + ucrBase.clsRsyntax.RemoveParameter("doy") + ucrBase.clsRsyntax.RemoveParameter("year") + ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yearmonthday") + If Not ucrReceiverYearThree.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearThree.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("year") + End If + If ucrReceiverMonthThree.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("month", ucrReceiverMonthThree.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("month") + End If + If ucrReceiverDayThree.IsEmpty = False Then + ucrBase.clsRsyntax.AddParameter("day", ucrReceiverDayThree.GetVariableNames()) + Else + ucrBase.clsRsyntax.RemoveParameter("day") + End If + grpThreeColumns.Visible = True + grpTwoColumns.Visible = False + grpSingleColumn.Visible = False + ucrBase.clsRsyntax.RemoveParameter("x") ucrBase.clsRsyntax.RemoveParameter("format") ucrBase.clsRsyntax.RemoveParameter("origin") End If End Sub -End Class - - - - +End Class \ No newline at end of file From d859319e698687f46ee23b1d5cb894093f136016 Mon Sep 17 00:00:00 2001 From: Lily Date: Mon, 10 Oct 2016 17:50:12 +0100 Subject: [PATCH 15/37] One Var Models So Far --- instat/dlgOneVarCompareModels.vb | 7 +- instat/dlgOneVarFitModel.vb | 1 + instat/sdgOneVarCompareModels.Designer.vb | 15 +- instat/sdgOneVarCompareModels.vb | 98 ++++++++----- instat/sdgOneVarFitModDisplay.Designer.vb | 161 +++++++++++----------- instat/sdgOneVarFitModDisplay.vb | 28 +++- instat/sdgOneVarUseModFit.vb | 10 +- 7 files changed, 190 insertions(+), 130 deletions(-) diff --git a/instat/dlgOneVarCompareModels.vb b/instat/dlgOneVarCompareModels.vb index 86256d189b7..eba694a2142 100644 --- a/instat/dlgOneVarCompareModels.vb +++ b/instat/dlgOneVarCompareModels.vb @@ -55,10 +55,11 @@ Public Class dlgOneVarCompareModels ' variables not fromvariablex cannot be in dataframe Private Sub ReopenDialog() + sdgOneVarCompareModels.Reopen() End Sub - Private Sub TestOKEnabled() - If Not UcrReceiver.IsEmpty Then + Public Sub TestOKEnabled() + If sdgOneVarCompareModels.TestOkEnabled() AndAlso Not UcrReceiver.IsEmpty Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -70,6 +71,7 @@ Public Class dlgOneVarCompareModels End Sub Private Sub ucrSelectorOneVarCompModels_DataFrameChanged() Handles ucrSelectorOneVarCompModels.DataFrameChanged + sdgOneVarCompareModels.DisplayChiSquare() End Sub Private Sub UcrReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles UcrReceiver.SelectionChanged @@ -86,6 +88,7 @@ Public Class dlgOneVarCompareModels Private Sub cmdDisplayObjects_Click(sender As Object, e As EventArgs) Handles cmdDisplayObjects.Click sdgOneVarCompareModels.ShowDialog() EnableOptions() + TestOKEnabled() End Sub diff --git a/instat/dlgOneVarFitModel.vb b/instat/dlgOneVarFitModel.vb index 70ddf23684b..5218fe28225 100644 --- a/instat/dlgOneVarFitModel.vb +++ b/instat/dlgOneVarFitModel.vb @@ -48,6 +48,7 @@ Public Class dlgOneVarFitModel sdgOneVarFitModel.SetMyRSyntax(UcrBase.clsRsyntax) sdgOneVarFitModDisplay.SetDistribution(UcrDistributions) sdgOneVarFitModel.SetDistribution(UcrDistributions) + sdgOneVarFitModDisplay.AssignSaveLikelihood() End Sub Private Sub SetDefaults() diff --git a/instat/sdgOneVarCompareModels.Designer.vb b/instat/sdgOneVarCompareModels.Designer.vb index 3c086fefb85..e21ad26a0f6 100644 --- a/instat/sdgOneVarCompareModels.Designer.vb +++ b/instat/sdgOneVarCompareModels.Designer.vb @@ -36,6 +36,7 @@ Partial Class sdgOneVarCompareModels Me.chkCDF = New System.Windows.Forms.CheckBox() Me.chkPP = New System.Windows.Forms.CheckBox() Me.chkDensity = New System.Windows.Forms.CheckBox() + Me.ucrDisplayChiData = New instat.ucrInputTextBox() Me.TabControl1.SuspendLayout() Me.TabPage1.SuspendLayout() Me.TabPage2.SuspendLayout() @@ -99,6 +100,7 @@ Partial Class sdgOneVarCompareModels ' 'TabPage1 ' + Me.TabPage1.Controls.Add(Me.ucrDisplayChiData) Me.TabPage1.Controls.Add(Me.ucrObjectName) Me.TabPage1.Controls.Add(Me.chkSaveObjects) Me.TabPage1.Controls.Add(Me.lblGoF) @@ -115,9 +117,9 @@ Partial Class sdgOneVarCompareModels 'ucrObjectName ' Me.ucrObjectName.IsReadOnly = False - Me.ucrObjectName.Location = New System.Drawing.Point(97, 27) + Me.ucrObjectName.Location = New System.Drawing.Point(129, 27) Me.ucrObjectName.Name = "ucrObjectName" - Me.ucrObjectName.Size = New System.Drawing.Size(107, 21) + Me.ucrObjectName.Size = New System.Drawing.Size(139, 21) Me.ucrObjectName.TabIndex = 5 ' 'TabPage2 @@ -182,6 +184,14 @@ Partial Class sdgOneVarCompareModels Me.chkDensity.Text = "Density" Me.chkDensity.UseVisualStyleBackColor = True ' + 'ucrDisplayChiData + ' + Me.ucrDisplayChiData.IsReadOnly = False + Me.ucrDisplayChiData.Location = New System.Drawing.Point(129, 51) + Me.ucrDisplayChiData.Name = "ucrDisplayChiData" + Me.ucrDisplayChiData.Size = New System.Drawing.Size(139, 21) + Me.ucrDisplayChiData.TabIndex = 6 + ' 'sdgOneVarCompareModels ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -217,4 +227,5 @@ Partial Class sdgOneVarCompareModels Friend WithEvents chkQQ As CheckBox Friend WithEvents ucrObjectName As ucrInputTextBox Friend WithEvents ucrSavePlots As ucrSaveGraph + Friend WithEvents ucrDisplayChiData As ucrInputTextBox End Class diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index a66fdd631ec..3cf0ebb20d5 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -16,14 +16,8 @@ Imports instat.Translations Public Class sdgOneVarCompareModels - Private clsRcdfcompFunction As New RFunction - Private clsRdenscompFunction As New RFunction - Private clsRqqcompFunction As New RFunction - Private clsRppcompFunction As New RFunction - Private clsListFunction As New RFunction + Private clsRcdfcompFunction, clsRdenscompFunction, clsRqqcompFunction, clsRppcompFunction, clsListFunction, clsRAsDataFrame, clsModel, clsRsyntax, clsOperation As New RFunction Private clsGetObjectOperator As New ROperator - Private clsModel As New RFunction - Private clsRsyntax As New RFunction Private WithEvents ucrRecs As ucrReceiver Public bfirstload As Boolean = True @@ -37,6 +31,9 @@ Public Class sdgOneVarCompareModels clsRdenscompFunction.SetRCommand("denscomp") clsRqqcompFunction.SetRCommand("qqcomp") clsRppcompFunction.SetRCommand("ppcomp") + ucrDisplayChiData.SetValidationTypeAsRVariable() + ' set default name + ' if not checked, then this doesn't show End Sub Public Sub SetDefaults() @@ -52,15 +49,21 @@ Public Class sdgOneVarCompareModels ucrSavePlots.ucrInputGraphName.SetPrefix("plots") ucrObjectName.SetValidationTypeAsRVariable() ucrObjectName.SetName("gof") - CreateGraphs() + ucrDisplayChiData.Reset() + ucrDisplayChiData.SetName(dlgOneVarCompareModels.ucrSelectorOneVarCompModels.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_ChiSquare") ReturnEnabled() DisplayChiSquare() 'ucrBase.ihelptopicID = End Sub + Public Sub Reopen() + DisplayChiSquare() + End Sub + Public Sub SetModelFunction(clsNewModel As RFunction) clsModel = clsNewModel clsRcdfcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) + ' clSr.... :=clsModel clsRdenscompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) clsRppcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) clsRqqcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) @@ -68,19 +71,29 @@ Public Class sdgOneVarCompareModels Public Sub DisplayChiSquare() If chkSaveChi.Checked Then - dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperation("$") - dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsModel) - dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(False, strValue:="chisqtable") + ucrDisplayChiData.Visible = True + clsGetObjectOperator.SetOperation("$") + clsGetObjectOperator.SetParameter(True, clsRFunc:=clsModel) + clsGetObjectOperator.SetParameter(False, strValue:="chisqtable") + clsRAsDataFrame.SetRCommand("as.data.frame") + clsRAsDataFrame.AddParameter("x", clsROperatorParameter:=clsGetObjectOperator) + Else + ucrDisplayChiData.Visible = False + End If + If Not ucrDisplayChiData.IsEmpty Then + clsRAsDataFrame.SetAssignTo(ucrDisplayChiData.GetText(), strTempDataframe:=ucrDisplayChiData.GetText()) + Else + clsRAsDataFrame.RemoveAssignTo() + End If + End Sub - 'dlgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsGetObjectOperator) - 'd lgOneVarCompareModels.ucrBase.clsRsyntax.SetOperatorParameter(False, "chisqtable") + Private Sub ucrDisplayChiData_NameChanged() Handles ucrDisplayChiData.NameChanged + DisplayChiSquare() + End Sub - End If - 'If our distribution is continuous, then enable the option to display chi-square - 'For continuous this is always enabled. - End Sub + ' if it is selected and not given a default name then what happens Public Sub SetReceiver(ucrNewReceiver As ucrReceiver) ucrRecs = ucrNewReceiver @@ -97,22 +110,24 @@ Public Class sdgOneVarCompareModels Public Sub CreateGraphs() - If Not dlgOneVarCompareModels.UcrReceiver.IsEmpty Then - If chkCDF.Checked Then - frmMain.clsRLink.RunScript(clsRcdfcompFunction.ToScript(), 2) - End If - If chkPP.Checked Then - frmMain.clsRLink.RunScript(clsRppcompFunction.ToScript(), 2) - End If - If chkQQ.Checked Then - frmMain.clsRLink.RunScript(clsRqqcompFunction.ToScript(), 2) - End If - If chkDensity.Checked Then - frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) - End If - If chkSaveChi.Checked Then - frmMain.clsRLink.RunScript(clsGetObjectOperator.ToScript(), 2) - End If + Dim strTemp As String = "" + + If chkCDF.Checked Then + frmMain.clsRLink.RunScript(clsRcdfcompFunction.ToScript(), 2) + End If + If chkPP.Checked Then + frmMain.clsRLink.RunScript(clsRppcompFunction.ToScript(), 2) + End If + If chkQQ.Checked Then + frmMain.clsRLink.RunScript(clsRqqcompFunction.ToScript(), 2) + End If + If chkDensity.Checked Then + frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) + End If + If chkSaveChi.Checked Then + frmMain.clsRLink.RunScript(clsGetObjectOperator.ToScript(), 0) + clsRAsDataFrame.ToScript(strTemp) + frmMain.clsRLink.RunScript(strTemp, 0) End If End Sub @@ -147,15 +162,22 @@ Public Class sdgOneVarCompareModels End Sub Private Sub chkSaveChi_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveChi.CheckedChanged - 'dlgOneVarCompareModels.ucrBase.clsRsyntax. - - - 'display 5th element of object - the chisquare if this is selected. - ' for discrete this is shown anyway + DisplayChiSquare() End Sub ' Private Sub ucrSavePlots_NameChanged() Handles ucrSavePlots.Click 'TODO Graph Names assigned go up in increments for any of the graphs selected (e.g. 3 plots are selected and it is named "plots", then automatically we get "plots1", ... , "plots3" 'End Sub + + Public Function TestOkEnabled() As Boolean + Dim bOkEnabled As Boolean + If (chkSaveObjects.Checked AndAlso Not ucrObjectName.IsEmpty) AndAlso (chkSaveChi.Checked AndAlso Not ucrDisplayChiData.IsEmpty) Then + bOkEnabled = True + Else + bOkEnabled = False + End If + Return bOkEnabled + End Function + End Class \ No newline at end of file diff --git a/instat/sdgOneVarFitModDisplay.Designer.vb b/instat/sdgOneVarFitModDisplay.Designer.vb index 84c91680f36..c352c41c2b6 100644 --- a/instat/sdgOneVarFitModDisplay.Designer.vb +++ b/instat/sdgOneVarFitModDisplay.Designer.vb @@ -23,7 +23,12 @@ Partial Class sdgOneVarFitModDisplay _ Private Sub InitializeComponent() Me.ucrBase = New instat.ucrButtonsSubdialogue() + Me.tbclikelihood = New System.Windows.Forms.TabPage() + Me.rdoNoLik = New System.Windows.Forms.RadioButton() + Me.rdoLik = New System.Windows.Forms.RadioButton() + Me.rdoLoglik = New System.Windows.Forms.RadioButton() Me.TabPage1 = New System.Windows.Forms.TabPage() + Me.ucrSavePlots = New instat.ucrSaveGraph() Me.rdoPPPlot = New System.Windows.Forms.RadioButton() Me.rdoQQPlot = New System.Windows.Forms.RadioButton() Me.rdoDensityPlot = New System.Windows.Forms.RadioButton() @@ -31,26 +36,69 @@ Partial Class sdgOneVarFitModDisplay Me.rdoPlotAll = New System.Windows.Forms.RadioButton() Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.tbcPlots = New System.Windows.Forms.TabControl() - Me.tbclikelihood = New System.Windows.Forms.TabPage() - Me.rdoNoLik = New System.Windows.Forms.RadioButton() - Me.ucrSaveLikelihood = New instat.ucrSaveGraph() - Me.rdoLik = New System.Windows.Forms.RadioButton() - Me.rdoLoglik = New System.Windows.Forms.RadioButton() - Me.tbcSavePlots = New System.Windows.Forms.TabPage() + Me.UcrSaveLikelihood = New instat.ucrSaveGraph() + Me.tbclikelihood.SuspendLayout() Me.TabPage1.SuspendLayout() Me.tbcPlots.SuspendLayout() - Me.tbclikelihood.SuspendLayout() Me.SuspendLayout() ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(14, 219) + Me.ucrBase.Location = New System.Drawing.Point(12, 227) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(142, 30) Me.ucrBase.TabIndex = 1 ' + 'tbclikelihood + ' + Me.tbclikelihood.Controls.Add(Me.UcrSaveLikelihood) + Me.tbclikelihood.Controls.Add(Me.rdoNoLik) + Me.tbclikelihood.Controls.Add(Me.rdoLik) + Me.tbclikelihood.Controls.Add(Me.rdoLoglik) + Me.tbclikelihood.Location = New System.Drawing.Point(4, 22) + Me.tbclikelihood.Name = "tbclikelihood" + Me.tbclikelihood.Padding = New System.Windows.Forms.Padding(3) + Me.tbclikelihood.Size = New System.Drawing.Size(288, 185) + Me.tbclikelihood.TabIndex = 1 + Me.tbclikelihood.Text = "Likelihood" + Me.tbclikelihood.UseVisualStyleBackColor = True + ' + 'rdoNoLik + ' + Me.rdoNoLik.AutoSize = True + Me.rdoNoLik.Location = New System.Drawing.Point(8, 66) + Me.rdoNoLik.Name = "rdoNoLik" + Me.rdoNoLik.Size = New System.Drawing.Size(60, 17) + Me.rdoNoLik.TabIndex = 2 + Me.rdoNoLik.TabStop = True + Me.rdoNoLik.Text = "No Plot" + Me.rdoNoLik.UseVisualStyleBackColor = True + ' + 'rdoLik + ' + Me.rdoLik.AutoSize = True + Me.rdoLik.Location = New System.Drawing.Point(8, 43) + Me.rdoLik.Name = "rdoLik" + Me.rdoLik.Size = New System.Drawing.Size(94, 17) + Me.rdoLik.TabIndex = 1 + Me.rdoLik.TabStop = True + Me.rdoLik.Text = "Plot Likelihood" + Me.rdoLik.UseVisualStyleBackColor = True + ' + 'rdoLoglik + ' + Me.rdoLoglik.AutoSize = True + Me.rdoLoglik.Location = New System.Drawing.Point(8, 20) + Me.rdoLoglik.Name = "rdoLoglik" + Me.rdoLoglik.Size = New System.Drawing.Size(115, 17) + Me.rdoLoglik.TabIndex = 0 + Me.rdoLoglik.TabStop = True + Me.rdoLoglik.Text = "Plot Log-Likelihood" + Me.rdoLoglik.UseVisualStyleBackColor = True + ' 'TabPage1 ' + Me.TabPage1.Controls.Add(Me.ucrSavePlots) Me.TabPage1.Controls.Add(Me.rdoPPPlot) Me.TabPage1.Controls.Add(Me.rdoQQPlot) Me.TabPage1.Controls.Add(Me.rdoDensityPlot) @@ -60,11 +108,18 @@ Partial Class sdgOneVarFitModDisplay Me.TabPage1.Location = New System.Drawing.Point(4, 22) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage1.Size = New System.Drawing.Size(237, 177) + Me.TabPage1.Size = New System.Drawing.Size(262, 185) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = "Plots" Me.TabPage1.UseVisualStyleBackColor = True ' + 'ucrSavePlots + ' + Me.ucrSavePlots.Location = New System.Drawing.Point(8, 158) + Me.ucrSavePlots.Name = "ucrSavePlots" + Me.ucrSavePlots.Size = New System.Drawing.Size(248, 20) + Me.ucrSavePlots.TabIndex = 4 + ' 'rdoPPPlot ' Me.rdoPPPlot.AutoSize = True @@ -131,82 +186,24 @@ Partial Class sdgOneVarFitModDisplay ' Me.tbcPlots.Controls.Add(Me.TabPage1) Me.tbcPlots.Controls.Add(Me.tbclikelihood) - Me.tbcPlots.Controls.Add(Me.tbcSavePlots) Me.tbcPlots.Location = New System.Drawing.Point(10, 10) Me.tbcPlots.Name = "tbcPlots" Me.tbcPlots.SelectedIndex = 0 - Me.tbcPlots.Size = New System.Drawing.Size(245, 203) + Me.tbcPlots.Size = New System.Drawing.Size(296, 211) Me.tbcPlots.TabIndex = 0 ' - 'tbclikelihood - ' - Me.tbclikelihood.Controls.Add(Me.rdoNoLik) - Me.tbclikelihood.Controls.Add(Me.ucrSaveLikelihood) - Me.tbclikelihood.Controls.Add(Me.rdoLik) - Me.tbclikelihood.Controls.Add(Me.rdoLoglik) - Me.tbclikelihood.Location = New System.Drawing.Point(4, 22) - Me.tbclikelihood.Name = "tbclikelihood" - Me.tbclikelihood.Padding = New System.Windows.Forms.Padding(3) - Me.tbclikelihood.Size = New System.Drawing.Size(237, 177) - Me.tbclikelihood.TabIndex = 1 - Me.tbclikelihood.Text = "Likelihood" - Me.tbclikelihood.UseVisualStyleBackColor = True - ' - 'rdoNoLik - ' - Me.rdoNoLik.AutoSize = True - Me.rdoNoLik.Location = New System.Drawing.Point(6, 64) - Me.rdoNoLik.Name = "rdoNoLik" - Me.rdoNoLik.Size = New System.Drawing.Size(60, 17) - Me.rdoNoLik.TabIndex = 2 - Me.rdoNoLik.TabStop = True - Me.rdoNoLik.Text = "No Plot" - Me.rdoNoLik.UseVisualStyleBackColor = True - ' - 'ucrSaveLikelihood + 'UcrSaveLikelihood ' - Me.ucrSaveLikelihood.Location = New System.Drawing.Point(6, 140) - Me.ucrSaveLikelihood.Name = "ucrSaveLikelihood" - Me.ucrSaveLikelihood.Size = New System.Drawing.Size(226, 20) - Me.ucrSaveLikelihood.TabIndex = 3 - ' - 'rdoLik - ' - Me.rdoLik.AutoSize = True - Me.rdoLik.Location = New System.Drawing.Point(6, 41) - Me.rdoLik.Name = "rdoLik" - Me.rdoLik.Size = New System.Drawing.Size(94, 17) - Me.rdoLik.TabIndex = 1 - Me.rdoLik.TabStop = True - Me.rdoLik.Text = "Plot Likelihood" - Me.rdoLik.UseVisualStyleBackColor = True - ' - 'rdoLoglik - ' - Me.rdoLoglik.AutoSize = True - Me.rdoLoglik.Location = New System.Drawing.Point(6, 18) - Me.rdoLoglik.Name = "rdoLoglik" - Me.rdoLoglik.Size = New System.Drawing.Size(115, 17) - Me.rdoLoglik.TabIndex = 0 - Me.rdoLoglik.TabStop = True - Me.rdoLoglik.Text = "Plot Log-Likelihood" - Me.rdoLoglik.UseVisualStyleBackColor = True - ' - 'tbcSavePlots - ' - Me.tbcSavePlots.Location = New System.Drawing.Point(4, 22) - Me.tbcSavePlots.Name = "tbcSavePlots" - Me.tbcSavePlots.Padding = New System.Windows.Forms.Padding(3) - Me.tbcSavePlots.Size = New System.Drawing.Size(237, 177) - Me.tbcSavePlots.TabIndex = 2 - Me.tbcSavePlots.Text = "Save Plots" - Me.tbcSavePlots.UseVisualStyleBackColor = True + Me.UcrSaveLikelihood.Location = New System.Drawing.Point(8, 159) + Me.UcrSaveLikelihood.Name = "UcrSaveLikelihood" + Me.UcrSaveLikelihood.Size = New System.Drawing.Size(265, 20) + Me.UcrSaveLikelihood.TabIndex = 3 ' 'sdgOneVarFitModDisplay ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(311, 256) + Me.ClientSize = New System.Drawing.Size(311, 263) Me.Controls.Add(Me.tbcPlots) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow @@ -214,15 +211,19 @@ Partial Class sdgOneVarFitModDisplay Me.MinimizeBox = False Me.Name = "sdgOneVarFitModDisplay" Me.Text = "Display Options" + Me.tbclikelihood.ResumeLayout(False) + Me.tbclikelihood.PerformLayout() Me.TabPage1.ResumeLayout(False) Me.TabPage1.PerformLayout() Me.tbcPlots.ResumeLayout(False) - Me.tbclikelihood.ResumeLayout(False) - Me.tbclikelihood.PerformLayout() Me.ResumeLayout(False) End Sub Friend WithEvents ucrBase As ucrButtonsSubdialogue + Friend WithEvents tbclikelihood As TabPage + Friend WithEvents rdoNoLik As RadioButton + Friend WithEvents rdoLik As RadioButton + Friend WithEvents rdoLoglik As RadioButton Friend WithEvents TabPage1 As TabPage Friend WithEvents rdoPPPlot As RadioButton Friend WithEvents rdoQQPlot As RadioButton @@ -231,10 +232,6 @@ Partial Class sdgOneVarFitModDisplay Friend WithEvents rdoPlotAll As RadioButton Friend WithEvents rdoNoPlot As RadioButton Friend WithEvents tbcPlots As TabControl - Friend WithEvents tbclikelihood As TabPage - Friend WithEvents tbcSavePlots As TabPage - Friend WithEvents rdoNoLik As RadioButton - Friend WithEvents ucrSaveLikelihood As ucrSaveGraph - Friend WithEvents rdoLik As RadioButton - Friend WithEvents rdoLoglik As RadioButton + Friend WithEvents ucrSavePlots As ucrSaveGraph + Friend WithEvents UcrSaveLikelihood As ucrSaveGraph End Class diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index ad31068d738..aa5e79690e1 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -17,9 +17,11 @@ Imports instat.Translations Public Class sdgOneVarFitModDisplay Private clsRplotFunction As New RFunction + Private clsSaveLikelihood As New RFunction Private clsModel As New RFunction Private clsRLogLikFunction As New RFunction Private WithEvents ucrDists As ucrDistributions + Public clsRdataframe As ucrDataFrame Public bfirstload As Boolean = True Private Sub sdgOneVarFitModDisplay(sender As Object, e As EventArgs) Handles MyBase.Load @@ -27,13 +29,25 @@ Public Class sdgOneVarFitModDisplay End Sub Public Sub InitialiseDialog() + ucrSavePlots.ucrInputGraphName.SetItemsTypeAsGraphs() + ucrSavePlots.ucrInputGraphName.SetDefaultTypeAsGraph() + ucrSavePlots.ucrInputGraphName.SetValidationTypeAsRVariable() + ucrSavePlots.ucrInputGraphName.SetPrefix(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_Plot") + ucrSaveLikelihood.ucrInputGraphName.SetItemsTypeAsGraphs() + ucrSaveLikelihood.ucrInputGraphName.SetDefaultTypeAsGraph() + ucrSaveLikelihood.ucrInputGraphName.SetValidationTypeAsRVariable() + ucrSaveLikelihood.ucrInputGraphName.SetPrefix(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_Likelihood") End Sub Public Sub SetDefaults() rdoPlotAll.Checked = True rdoLoglik.Checked = True - ucrSaveLikelihood.Enabled = False + 'ucrSaveLikelihood.Enabled = False 'ucrBase.ihelptopicID = + ucrSaveLikelihood.Reset() + ucrSavePlots.Reset() + ucrSavePlots.chkSaveGraph.Checked = False + ucrSaveLikelihood.chkSaveGraph.Checked = False End Sub Public Sub SetModelFunction(clsNewModel As RFunction) @@ -117,4 +131,16 @@ Public Class sdgOneVarFitModDisplay End If End Sub + Private Sub ucrSaveLikelihood_GraphNameChanged() + AssignSaveLikelihood() + End Sub + + Public Sub AssignSaveLikelihood() + ' If ucrSaveLikelihood.chkSaveGraph.Checked AndAlso Not ucrSaveLikelihood.ucrInputGraphName.IsEmpty Then + ' dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo(ucrSaveLikelihood.ucrInputGraphName.GetText, strTempGraph:=ucrSaveLikelihood.ucrInputGraphName.GetText, strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ' Else + ' dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo("last_graph", strTempGraph:="last_graph", strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ' End If + 'End Sub + 'need to sort this End Class \ No newline at end of file diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index e533844308a..dd58d22d748 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -59,23 +59,23 @@ Public Class sdgOneVarUseModFit If rdoPlotAll.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("plot") - clsRplotFunction.AddParameter("x", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) + clsRplotFunction.AddParameter("x", clsRFunctionParameter:=clsModel) ElseIf rdoPPPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("ppcomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) ElseIf rdoCDFPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("cdfcomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) ElseIf rdoQQPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("qqcomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) ElseIf rdoDensityPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("denscomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) ElseIf rdoCIcdf.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("CIcdfplot") From 4383a75136a7bb212ff09911a1364f8dd9e86d78 Mon Sep 17 00:00:00 2001 From: Stephen Kogo Date: Tue, 11 Oct 2016 09:31:05 +0300 Subject: [PATCH 16/37] Final edits --- instat/dlgCorrelation.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgCorrelation.vb b/instat/dlgCorrelation.vb index 4588df28f48..10a2c4f7bc7 100644 --- a/instat/dlgCorrelation.vb +++ b/instat/dlgCorrelation.vb @@ -40,7 +40,6 @@ Public Class dlgCorrelation ucrSelectorDataFrameVarAddRemove.Focus() ucrReceiverMultipleColumns.SetSingleTypeStatus(True) ucrReceiverMultipleColumns.SetDataType("numeric") - ucrReceiverMultipleColumns.SetMeAsReceiver() ucrBase.iHelpTopicID = 186 End Sub @@ -52,6 +51,7 @@ Public Class dlgCorrelation rdoPearson.Checked = True rdoMultipleColumns.Checked = True sdgCorrPlot.SetDefaults() + ucrReceiverMultipleColumns.SetMeAsReceiver() TestOKEnabled() End Sub From 221f341591c0f8b24d76edd22ec3a5d2cf02a962 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Tue, 11 Oct 2016 11:47:14 +0300 Subject: [PATCH 17/37] Adding Help IDs on calculator --- instat/dlgCalculator.designer.vb | 18 +++++++++--------- instat/dlgCalculator.vb | 25 ++++++++++++++++++++++--- instat/ucrButtons.vb | 6 +++++- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/instat/dlgCalculator.designer.vb b/instat/dlgCalculator.designer.vb index 7f1cb7ec141..766e1174c50 100644 --- a/instat/dlgCalculator.designer.vb +++ b/instat/dlgCalculator.designer.vb @@ -144,12 +144,12 @@ Partial Class dlgCalculator Me.cmdLfact = New System.Windows.Forms.Button() Me.cmdTrigamma = New System.Windows.Forms.Button() Me.cmdBeta = New System.Windows.Forms.Button() + Me.ucrBase = New instat.ucrButtons() Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() Me.ucrSaveResultInto = New instat.ucrInputComboBox() Me.ucrInputTryMessage = New instat.ucrInputTextBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() - Me.ucrBase = New instat.ucrButtons() Me.grpBasic.SuspendLayout() Me.grpDates.SuspendLayout() Me.grpMaths.SuspendLayout() @@ -1547,6 +1547,14 @@ Partial Class dlgCalculator Me.cmdBeta.Text = "beta" Me.cmdBeta.UseVisualStyleBackColor = True ' + 'ucrBase + ' + Me.ucrBase.Location = New System.Drawing.Point(8, 285) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(404, 51) + Me.ucrBase.TabIndex = 0 + ' 'ucrInputCalOptions ' Me.ucrInputCalOptions.IsReadOnly = False @@ -1593,14 +1601,6 @@ Partial Class dlgCalculator Me.ucrSelectorForCalculations.Size = New System.Drawing.Size(210, 181) Me.ucrSelectorForCalculations.TabIndex = 106 ' - 'ucrBase - ' - Me.ucrBase.Location = New System.Drawing.Point(8, 285) - Me.ucrBase.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(404, 51) - Me.ucrBase.TabIndex = 0 - ' 'dlgCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index 474fb27a4b9..2f683bf2d43 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -22,6 +22,7 @@ Public Class dlgCalculator Dim clsAttach As New RFunction Dim clsDetach As New RFunction Public bFirstLoad As Boolean = True + Public bHelpClicked As Boolean = False Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -81,7 +82,7 @@ Public Class dlgCalculator ucrSaveResultInto.SetDefaultTypeAsColumn() ucrSaveResultInto.SetDataFrameSelector(ucrSelectorForCalculations.ucrAvailableDataFrames) ucrSelectorForCalculations.Reset() - ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Statistics", "Strings", "Probability", "Dates"}) + ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Summary", "Strings", "Probability", "Dates"}) ucrSaveResultInto.SetValidationTypeAsRVariable() End Sub @@ -212,6 +213,15 @@ Public Class dlgCalculator End Sub Private Sub ucrInputCalOptions_NameChanged() Handles ucrInputCalOptions.NameChanged + CalculationsOptions() + + If ucrBase.bHelpCLicked Then + ucrBase.HelpContent() + End If + + End Sub + + Private Sub CalculationsOptions() Select Case ucrInputCalOptions.GetText Case "Maths" grpStatistics.Visible = False @@ -220,6 +230,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpStrings.Visible = False grpProbabilty.Visible = False + ucrBase.iHelpTopicID = 126 Me.Size = New System.Drawing.Size(614, 377) Case "Logical and Symbols" grpDates.Visible = False @@ -230,7 +241,8 @@ Public Class dlgCalculator grpStrings.Visible = False Me.Size = New System.Drawing.Size(580, 377) grpProbabilty.Visible = False - Case "Statistics" + ucrBase.iHelpTopicID = 127 + Case "Summary" grpDates.Visible = False grpStatistics.Visible = True grpLogical.Visible = False @@ -239,6 +251,7 @@ Public Class dlgCalculator Me.Size = New System.Drawing.Size(552, 377) grpStrings.Visible = False grpProbabilty.Visible = False + ucrBase.iHelpTopicID = 128 Case "Strings" grpDates.Visible = False grpStrings.Visible = True @@ -248,6 +261,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpProbabilty.Visible = False Me.Size = New System.Drawing.Size(580, 377) + ucrBase.iHelpTopicID = 338 Case "Probability" grpDates.Visible = False grpProbabilty.Visible = True @@ -257,6 +271,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(749, 377) + ucrBase.iHelpTopicID = 120 Case "Dates" grpDates.Visible = True grpProbabilty.Visible = False @@ -266,6 +281,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(589, 377) + ucrBase.iHelpTopicID = 130 Case Else grpDates.Visible = False Me.Size = New System.Drawing.Size(424, 377) @@ -277,7 +293,6 @@ Public Class dlgCalculator grpStrings.Visible = False End Select End Sub - Private Sub cmdPi_Click(sender As Object, e As EventArgs) Handles cmdPi.Click ucrReceiverForCalculation.AddToReceiverAtCursorPosition("pi") End Sub @@ -957,4 +972,8 @@ Public Class dlgCalculator Private Sub cmdTry_Click(sender As Object, e As EventArgs) Handles cmdTry.Click TryScript() End Sub + + Private Sub ucrBase_HelpRequested(sender As Object, hlpevent As HelpEventArgs) Handles ucrBase.HelpRequested + bHelpClicked = True + End Sub End Class \ No newline at end of file diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index ffb260a1e0e..b072495488e 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -21,6 +21,7 @@ Public Class ucrButtons Public iHelpTopicID As Integer Public bFirstLoad As Boolean Public strComment As String + Public bHelpCLicked As Boolean = False Public Sub New() ' This call is required by the designer. @@ -130,7 +131,11 @@ Public Class ucrButtons End Sub Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click + bHelpCLicked = True + HelpContent() + End Sub + Public Sub HelpContent() ' (1) Use HelpNDoc's Help Context number. Not dependent on HelpNDoc. If iHelpTopicID > 0 Then Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, iHelpTopicID.ToString()) @@ -145,7 +150,6 @@ Public Class ucrButtons ' covertion from .bas) to refer to the Help Context numbers. 'Help.ShowHelp(Me, strHelpFilePath, HelpNavigator.TopicId, mHelpConstants.HELP_Maths.ToString) End Sub - Private Sub chkComment_KeyPress(sender As Object, e As KeyPressEventArgs) Handles chkComment.KeyPress If e.KeyChar = vbCr And chkComment.Checked = True Then chkComment.Checked = False From 73b8561b2646c965efcf3c6efdeb8dcb8cb631ee Mon Sep 17 00:00:00 2001 From: Lunalo Date: Tue, 11 Oct 2016 11:55:23 +0300 Subject: [PATCH 18/37] Editing Calculator --- instat/dlgCalculator.vb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index 2f683bf2d43..9e66783aeb0 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -82,7 +82,7 @@ Public Class dlgCalculator ucrSaveResultInto.SetDefaultTypeAsColumn() ucrSaveResultInto.SetDataFrameSelector(ucrSelectorForCalculations.ucrAvailableDataFrames) ucrSelectorForCalculations.Reset() - ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Summary", "Strings", "Probability", "Dates"}) + ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Summary", "Text", "Runoff", "Dates"}) ucrSaveResultInto.SetValidationTypeAsRVariable() End Sub @@ -252,7 +252,7 @@ Public Class dlgCalculator grpStrings.Visible = False grpProbabilty.Visible = False ucrBase.iHelpTopicID = 128 - Case "Strings" + Case "Text" grpDates.Visible = False grpStrings.Visible = True grpStatistics.Visible = False @@ -262,7 +262,7 @@ Public Class dlgCalculator grpProbabilty.Visible = False Me.Size = New System.Drawing.Size(580, 377) ucrBase.iHelpTopicID = 338 - Case "Probability" + Case "Runoff" grpDates.Visible = False grpProbabilty.Visible = True grpStrings.Visible = False @@ -291,6 +291,7 @@ Public Class dlgCalculator grpLogical.Visible = False grpMaths.Visible = False grpStrings.Visible = False + ucrBase.iHelpTopicID = 14 End Select End Sub Private Sub cmdPi_Click(sender As Object, e As EventArgs) Handles cmdPi.Click From c99f515336e492b16390d101b39349a66d09e06f Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Tue, 11 Oct 2016 12:19:36 +0300 Subject: [PATCH 19/37] Commenting out geoms --- instat/ucrGeom.vb | 1024 ++++++++++++++++++++++----------------------- 1 file changed, 512 insertions(+), 512 deletions(-) diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index dfbcb00d170..a62f8cc50cd 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -131,40 +131,40 @@ Public Class ucrGeom Dim clsgeom_vline As New Geoms - clsgeom_abline.SetGeomName("geom_abline") - clsgeom_abline.AddAesParameter("x", bIsMandatory:=True) - clsgeom_abline.AddAesParameter("y", bIsMandatory:=True) - clsgeom_abline.AddAesParameter("alpha") - clsgeom_abline.AddAesParameter("colour") - clsgeom_abline.AddAesParameter("linetype") - clsgeom_abline.AddAesParameter("size") - 'aesthetics that control position of line include - 'geom_vline:xintercept - 'geom_hline:yintercept - 'geom_abline: slope and intercept - 'TO DO Discuss how to use these - 'add layer parameters - clsgeom_abline.AddLayerParameter("intercept", "numeric", "0") - clsgeom_abline.AddLayerParameter("xxxxxxxx", "numeric", "0") - lstAllGeoms.Add(clsgeom_abline) - - clsgeom_area.SetGeomName("geom_area") - 'mandatory aesthetics - clsgeom_area.AddAesParameter("x", bIsMandatory:=True) - clsgeom_area.AddAesParameter("ymax", bIsMandatory:=True) - clsgeom_area.AddAesParameter("ymin", bIsMandatory:=True) - 'Optional - clsgeom_area.AddAesParameter("alpha") - clsgeom_area.AddAesParameter("colour") - clsgeom_area.AddAesParameter("fill") - clsgeom_area.AddAesParameter("linetype") - clsgeom_area.AddAesParameter("size") - - 'add layer parameters - clsgeom_area.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_area.AddLayerParameter("position", "list", Chr(34) & "stack" & Chr(34)) - clsgeom_area.AddLayerParameter("na.rm", "boolean", "FALSE") - lstAllGeoms.Add(clsgeom_area) + 'clsgeom_abline.SetGeomName("geom_abline") + 'clsgeom_abline.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_abline.AddAesParameter("y", bIsMandatory:=True) + 'clsgeom_abline.AddAesParameter("alpha") + 'clsgeom_abline.AddAesParameter("colour") + 'clsgeom_abline.AddAesParameter("linetype") + 'clsgeom_abline.AddAesParameter("size") + ''aesthetics that control position of line include + ''geom_vline:xintercept + ''geom_hline:yintercept + ''geom_abline: slope and intercept + ''TO DO Discuss how to use these + ''add layer parameters + 'clsgeom_abline.AddLayerParameter("intercept", "numeric", "0") + 'clsgeom_abline.AddLayerParameter("xxxxxxxx", "numeric", "0") + 'lstAllGeoms.Add(clsgeom_abline) + + 'clsgeom_area.SetGeomName("geom_area") + ''mandatory aesthetics + 'clsgeom_area.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_area.AddAesParameter("ymax", bIsMandatory:=True) + 'clsgeom_area.AddAesParameter("ymin", bIsMandatory:=True) + ''Optional + 'clsgeom_area.AddAesParameter("alpha") + 'clsgeom_area.AddAesParameter("colour") + 'clsgeom_area.AddAesParameter("fill") + 'clsgeom_area.AddAesParameter("linetype") + 'clsgeom_area.AddAesParameter("size") + + ''add layer parameters + 'clsgeom_area.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_area.AddLayerParameter("position", "list", Chr(34) & "stack" & Chr(34)) + 'clsgeom_area.AddLayerParameter("na.rm", "boolean", "FALSE") + 'lstAllGeoms.Add(clsgeom_area) clsgeom_bar.SetGeomName("geom_bar") clsgeom_bar.AddAesParameter("x", strIncludedDataTypes:=({"factor"}), bIsMandatory:=True) @@ -184,20 +184,20 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_bar) - clsgeom_bin2d.SetGeomName("geom_bin2d") - 'mandatory - clsgeom_bin2d.AddAesParameter("x", bIsMandatory:=True) - clsgeom_bin2d.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_bin2d.AddAesParameter("fill") - 'adding layer parameters - clsgeom_bin2d.AddLayerParameter("stat", "list", Chr(34) & "bin2d" & Chr(34)) - clsgeom_bin2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_bin2d.AddLayerParameter("na.rm", "boolean", "FALSE") - clsgeom_bin2d.AddLayerParameter("bins", "numeric", "30") - clsgeom_bin2d.AddLayerParameter("binwidth", "numeric", "0.1") + 'clsgeom_bin2d.SetGeomName("geom_bin2d") + ''mandatory + 'clsgeom_bin2d.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_bin2d.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_bin2d.AddAesParameter("fill") + ''adding layer parameters + 'clsgeom_bin2d.AddLayerParameter("stat", "list", Chr(34) & "bin2d" & Chr(34)) + 'clsgeom_bin2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_bin2d.AddLayerParameter("na.rm", "boolean", "FALSE") + 'clsgeom_bin2d.AddLayerParameter("bins", "numeric", "30") + 'clsgeom_bin2d.AddLayerParameter("binwidth", "numeric", "0.1") - lstAllGeoms.Add(clsgeom_bin2d) + 'lstAllGeoms.Add(clsgeom_bin2d) clsgeom_boxplot.SetGeomName("geom_boxplot") @@ -220,80 +220,80 @@ Public Class ucrGeom clsgeom_boxplot.AddLayerParameter("outlier.stroke ", "numeric", "0.5", lstParameterStrings:={1, 0}) lstAllGeoms.Add(clsgeom_boxplot) - clsgeom_contour.SetGeomName("geom_contour") - 'Mandatory - clsgeom_contour.AddAesParameter("x", bIsMandatory:=True) - clsgeom_contour.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_contour.AddAesParameter("alpha") - clsgeom_contour.AddAesParameter("colour") - clsgeom_contour.AddAesParameter("linetype") - clsgeom_contour.AddAesParameter("size") - clsgeom_contour.AddAesParameter("weight") - - 'add layer parameters - clsgeom_contour.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) - clsgeom_contour.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_contour.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) - 'linemitre should 1 or a number >1 - clsgeom_contour.AddLayerParameter("linemitre", "numeric", "1") - 'bin and binwidth could be added here as well. I am not sure if they are needed.... - lstAllGeoms.Add(clsgeom_contour) - - clsgeom_count.SetGeomName("geom_count") - 'mandatory - clsgeom_count.AddAesParameter("x", bIsMandatory:=True) - clsgeom_count.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_count.AddAesParameter("alpha") - clsgeom_count.AddAesParameter("colour") - clsgeom_count.AddAesParameter("fill") - clsgeom_count.AddAesParameter("shape") - clsgeom_count.AddAesParameter("size") - clsgeom_count.AddAesParameter("stroke") - - 'adding layer parameters - clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "sum" & Chr(34)) - clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_count) - - clsgeom_crossbar.strGeomName = "geom_crossbar" - 'Mandatory - clsgeom_crossbar.AddAesParameter("x", bIsMandatory:=True) - clsgeom_crossbar.AddAesParameter("ymax", bIsMandatory:=True) - clsgeom_crossbar.AddAesParameter("ymin", bIsMandatory:=True) - 'Optional - clsgeom_crossbar.AddAesParameter("alpha") - clsgeom_crossbar.AddAesParameter("colour") - clsgeom_crossbar.AddAesParameter("linetype") - clsgeom_crossbar.AddAesParameter("size") + 'clsgeom_contour.SetGeomName("geom_contour") + ''Mandatory + 'clsgeom_contour.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_contour.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_contour.AddAesParameter("alpha") + 'clsgeom_contour.AddAesParameter("colour") + 'clsgeom_contour.AddAesParameter("linetype") + 'clsgeom_contour.AddAesParameter("size") + 'clsgeom_contour.AddAesParameter("weight") + + ''add layer parameters + 'clsgeom_contour.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_contour.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_contour.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_contour.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_contour.AddLayerParameter("linemitre", "numeric", "1") + ''bin and binwidth could be added here as well. I am not sure if they are needed.... + 'lstAllGeoms.Add(clsgeom_contour) + + 'clsgeom_count.SetGeomName("geom_count") + ''mandatory + 'clsgeom_count.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_count.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_count.AddAesParameter("alpha") + 'clsgeom_count.AddAesParameter("colour") + 'clsgeom_count.AddAesParameter("fill") + 'clsgeom_count.AddAesParameter("shape") + 'clsgeom_count.AddAesParameter("size") + 'clsgeom_count.AddAesParameter("stroke") + + ''adding layer parameters + 'clsgeom_count.AddLayerParameter("stat", "list", Chr(34) & "sum" & Chr(34)) + 'clsgeom_count.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_count) + + 'clsgeom_crossbar.strGeomName = "geom_crossbar" + ''Mandatory + 'clsgeom_crossbar.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_crossbar.AddAesParameter("ymax", bIsMandatory:=True) + 'clsgeom_crossbar.AddAesParameter("ymin", bIsMandatory:=True) + ''Optional + 'clsgeom_crossbar.AddAesParameter("alpha") + 'clsgeom_crossbar.AddAesParameter("colour") + 'clsgeom_crossbar.AddAesParameter("linetype") + 'clsgeom_crossbar.AddAesParameter("size") - 'adding layer parameters - clsgeom_crossbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_crossbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_crossbar) - - clsgeom_curve.strGeomName = "geom_curve" - 'Mandatory - clsgeom_curve.AddAesParameter("x", bIsMandatory:=True) - clsgeom_curve.AddAesParameter("xend", bIsMandatory:=True) - clsgeom_curve.AddAesParameter("y", bIsMandatory:=True) - clsgeom_curve.AddAesParameter("yend", bIsMandatory:=True) - 'Optional - clsgeom_curve.AddAesParameter("alpha") - clsgeom_curve.AddAesParameter("colour") - clsgeom_curve.AddAesParameter("linetype") - clsgeom_curve.AddAesParameter("size") + ''adding layer parameters + 'clsgeom_crossbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_crossbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_crossbar) - 'adding layer parameters - clsgeom_curve.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_curve.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_curve.AddLayerParameter("curvature", "numeric", "0.5") 'numeric values. negative values give a left hand curve while positive values give right hand curves - clsgeom_curve.AddLayerParameter("angle", "numeric", "90") 'needs to be 0-180 - clsgeom_curve.AddLayerParameter("ncp", "numeric", "5") 'more control point creates a smoother curve - clsgeom_curve.AddLayerParameter("lineend", "list", "butt", lstParameterStrings:={Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - lstAllGeoms.Add(clsgeom_curve) + 'clsgeom_curve.strGeomName = "geom_curve" + ''Mandatory + 'clsgeom_curve.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_curve.AddAesParameter("xend", bIsMandatory:=True) + 'clsgeom_curve.AddAesParameter("y", bIsMandatory:=True) + 'clsgeom_curve.AddAesParameter("yend", bIsMandatory:=True) + ''Optional + 'clsgeom_curve.AddAesParameter("alpha") + 'clsgeom_curve.AddAesParameter("colour") + 'clsgeom_curve.AddAesParameter("linetype") + 'clsgeom_curve.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_curve.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_curve.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_curve.AddLayerParameter("curvature", "numeric", "0.5") 'numeric values. negative values give a left hand curve while positive values give right hand curves + 'clsgeom_curve.AddLayerParameter("angle", "numeric", "90") 'needs to be 0-180 + 'clsgeom_curve.AddLayerParameter("ncp", "numeric", "5") 'more control point creates a smoother curve + 'clsgeom_curve.AddLayerParameter("lineend", "list", "butt", lstParameterStrings:={Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'lstAllGeoms.Add(clsgeom_curve) clsgeom_density.strGeomName = "geom_density" 'mandatory @@ -316,43 +316,43 @@ Public Class ucrGeom clsgeom_density.AddLayerParameter("kernel", "list", Chr(34) & "gaussian" & Chr(34), lstParameterStrings:={Chr(34) & "gaussian" & Chr(34), Chr(34) & "rectangular" & Chr(34), Chr(34) & "triangular" & Chr(34), Chr(34) & "epanechnikov" & Chr(34), Chr(34) & "biweight" & Chr(34), Chr(34) & "cosine" & Chr(34), Chr(34) & "optcosin" & Chr(34)}) lstAllGeoms.Add(clsgeom_density) - clsgeom_density2d.strGeomName = "geom_density2d" - 'Mandatory - clsgeom_density2d.AddAesParameter("x", bIsMandatory:=True) - clsgeom_density2d.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_density2d.AddAesParameter("alpha") - clsgeom_density2d.AddAesParameter("colour") - clsgeom_density2d.AddAesParameter("linetype") - clsgeom_density2d.AddAesParameter("size") - - 'Adding layer parameters - clsgeom_density2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) - clsgeom_density2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_density2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_density2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) - 'linemitre should 1 or a number >1 - clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") - lstAllGeoms.Add(clsgeom_density2d) - - clsgeom_density_2d.strGeomName = "geom_density_2d" - 'Mandatory - clsgeom_density_2d.AddAesParameter("x", bIsMandatory:=True) - clsgeom_density_2d.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_density_2d.AddAesParameter("alpha") - clsgeom_density_2d.AddAesParameter("colour") - clsgeom_density_2d.AddAesParameter("linetype") - clsgeom_density_2d.AddAesParameter("size") - - 'Adding layer parameters - clsgeom_density_2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) - clsgeom_density_2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_density_2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_density_2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) - 'linemitre should 1 or a number >1 - clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") - lstAllGeoms.Add(clsgeom_density_2d) + 'clsgeom_density2d.strGeomName = "geom_density2d" + ''Mandatory + 'clsgeom_density2d.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_density2d.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_density2d.AddAesParameter("alpha") + 'clsgeom_density2d.AddAesParameter("colour") + 'clsgeom_density2d.AddAesParameter("linetype") + 'clsgeom_density2d.AddAesParameter("size") + + ''Adding layer parameters + 'clsgeom_density2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) + 'clsgeom_density2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_density2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_density2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") + 'lstAllGeoms.Add(clsgeom_density2d) + + 'clsgeom_density_2d.strGeomName = "geom_density_2d" + ''Mandatory + 'clsgeom_density_2d.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_density_2d.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_density_2d.AddAesParameter("alpha") + 'clsgeom_density_2d.AddAesParameter("colour") + 'clsgeom_density_2d.AddAesParameter("linetype") + 'clsgeom_density_2d.AddAesParameter("size") + + ''Adding layer parameters + 'clsgeom_density_2d.AddLayerParameter("stat", "list", Chr(34) & "density2d" & Chr(34)) + 'clsgeom_density_2d.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_density_2d.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_density_2d.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_density2d.AddLayerParameter("linemitre", "numeric", "1") + 'lstAllGeoms.Add(clsgeom_density_2d) clsgeom_dotplot.strGeomName = "geom_dotplot" clsgeom_dotplot.AddAesParameter("x", strIncludedDataTypes:={"factor", "numeric"}, bIsMandatory:=True) @@ -377,34 +377,34 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_dotplot) - clsgeom_errorbar.strGeomName = "geom_errorbar" - ''Mandatory - clsgeom_errorbar.AddAesParameter("x", bIsMandatory:=True) - clsgeom_errorbar.AddAesParameter("ymax", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) - clsgeom_errorbar.AddAesParameter("ymin", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) - ''Optional - clsgeom_errorbar.AddAesParameter("alpha", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("size", strIncludedDataTypes:={"factor"}) - clsgeom_errorbar.AddAesParameter("width", strIncludedDataTypes:={"numeric"}) - 'adding layer parameters - clsgeom_errorbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_errorbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_errorbar) - - clsgeom_errorbarh.strGeomName = "geom_errorbarh" - 'mandatory - clsgeom_errorbarh.AddAesParameter("x", bIsMandatory:=True) - clsgeom_errorbarh.AddAesParameter("xmax", bIsMandatory:=True) - clsgeom_errorbarh.AddAesParameter("xmin", bIsMandatory:=True) - clsgeom_errorbarh.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_errorbarh.AddAesParameter("alpha") - clsgeom_errorbarh.AddAesParameter("colour") - clsgeom_errorbarh.AddAesParameter("height") - clsgeom_errorbarh.AddAesParameter("linetype") - clsgeom_errorbarh.AddAesParameter("size") + 'clsgeom_errorbar.strGeomName = "geom_errorbar" + '''Mandatory + 'clsgeom_errorbar.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_errorbar.AddAesParameter("ymax", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) + 'clsgeom_errorbar.AddAesParameter("ymin", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) + '''Optional + 'clsgeom_errorbar.AddAesParameter("alpha", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("colour", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("linetype", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("size", strIncludedDataTypes:={"factor"}) + 'clsgeom_errorbar.AddAesParameter("width", strIncludedDataTypes:={"numeric"}) + ''adding layer parameters + 'clsgeom_errorbar.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_errorbar.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_errorbar) + + 'clsgeom_errorbarh.strGeomName = "geom_errorbarh" + ''mandatory + 'clsgeom_errorbarh.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_errorbarh.AddAesParameter("xmax", bIsMandatory:=True) + 'clsgeom_errorbarh.AddAesParameter("xmin", bIsMandatory:=True) + 'clsgeom_errorbarh.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_errorbarh.AddAesParameter("alpha") + 'clsgeom_errorbarh.AddAesParameter("colour") + 'clsgeom_errorbarh.AddAesParameter("height") + 'clsgeom_errorbarh.AddAesParameter("linetype") + 'clsgeom_errorbarh.AddAesParameter("size") 'add layer parameters clsgeom_errorbarh.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) @@ -425,20 +425,20 @@ Public Class ucrGeom clsgeom_freqpoly.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34), Chr(34) & "stack" & Chr(34), Chr(34) & "dodge" & Chr(34)}) lstAllGeoms.Add(clsgeom_freqpoly) - clsgeom_hex.strGeomName = "geom_hex" - 'mandatory - clsgeom_hex.AddAesParameter("x", bIsMandatory:=True) - clsgeom_hex.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_hex.AddAesParameter("alpha") - clsgeom_hex.AddAesParameter("colour") - clsgeom_hex.AddAesParameter("fill") - clsgeom_hex.AddAesParameter("size") + 'clsgeom_hex.strGeomName = "geom_hex" + ''mandatory + 'clsgeom_hex.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_hex.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_hex.AddAesParameter("alpha") + 'clsgeom_hex.AddAesParameter("colour") + 'clsgeom_hex.AddAesParameter("fill") + 'clsgeom_hex.AddAesParameter("size") - 'add layer parameter - clsgeom_hex.AddLayerParameter("stat", "list", Chr(34) & "binhex" & Chr(34)) - clsgeom_hex.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_hex) + ''add layer parameter + 'clsgeom_hex.AddLayerParameter("stat", "list", Chr(34) & "binhex" & Chr(34)) + 'clsgeom_hex.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_hex) clsgeom_histogram.strGeomName = "geom_histogram" clsgeom_histogram.AddAesParameter("x", strIncludedDataTypes:={"numeric"}, bIsMandatory:=True) @@ -457,36 +457,36 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_histogram) - clsgeom_hline.strGeomName = "geom_hline" - clsgeom_hline.AddAesParameter("alpha") - clsgeom_hline.AddAesParameter("colour") - clsgeom_hline.AddAesParameter("linetype") - clsgeom_hline.AddAesParameter("size") - 'aesthetics that control position of line include - 'geom_vline:xintercept - 'geom_hline:yintercept - 'geom_abline: slope and intercept - 'TO DO Discuss how to use these - 'add layer parameter - clsgeom_hline.AddLayerParameter("yintercept", "numeric", "0") - lstAllGeoms.Add(clsgeom_hline) - - clsgeom_jitter.strGeomName = "geom_jitter" - 'mandatory - clsgeom_jitter.AddAesParameter("x", bIsMandatory:=True) - clsgeom_jitter.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_jitter.AddAesParameter("alpha") - clsgeom_jitter.AddAesParameter("colour") - clsgeom_jitter.AddAesParameter("fill") - clsgeom_jitter.AddAesParameter("shape") - clsgeom_jitter.AddAesParameter("size") - clsgeom_jitter.AddAesParameter("stroke") - - 'add layer parameter - clsgeom_jitter.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_jitter.AddLayerParameter("position", "list", Chr(34) & "jitter" & Chr(34)) - lstAllGeoms.Add(clsgeom_jitter) + 'clsgeom_hline.strGeomName = "geom_hline" + 'clsgeom_hline.AddAesParameter("alpha") + 'clsgeom_hline.AddAesParameter("colour") + 'clsgeom_hline.AddAesParameter("linetype") + 'clsgeom_hline.AddAesParameter("size") + ''aesthetics that control position of line include + ''geom_vline:xintercept + ''geom_hline:yintercept + ''geom_abline: slope and intercept + ''TO DO Discuss how to use these + ''add layer parameter + 'clsgeom_hline.AddLayerParameter("yintercept", "numeric", "0") + 'lstAllGeoms.Add(clsgeom_hline) + + 'clsgeom_jitter.strGeomName = "geom_jitter" + ''mandatory + 'clsgeom_jitter.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_jitter.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_jitter.AddAesParameter("alpha") + 'clsgeom_jitter.AddAesParameter("colour") + 'clsgeom_jitter.AddAesParameter("fill") + 'clsgeom_jitter.AddAesParameter("shape") + 'clsgeom_jitter.AddAesParameter("size") + 'clsgeom_jitter.AddAesParameter("stroke") + + ''add layer parameter + 'clsgeom_jitter.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_jitter.AddLayerParameter("position", "list", Chr(34) & "jitter" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_jitter) 'clsgeom_label.strGeomName = "geom_label" ''mandatory @@ -519,53 +519,53 @@ Public Class ucrGeom lstAllGeoms.Add(clsgeom_line) - clsgeom_linerange.strGeomName = "geom_linerange" - 'mandatory - clsgeom_linerange.AddAesParameter("x", bIsMandatory:=True) - clsgeom_linerange.AddAesParameter("ymax", bIsMandatory:=True) - clsgeom_linerange.AddAesParameter("ymin", bIsMandatory:=True) - 'optional - clsgeom_linerange.AddAesParameter("alpha") - clsgeom_linerange.AddAesParameter("colour") - clsgeom_linerange.AddAesParameter("linetype") - clsgeom_linerange.AddAesParameter("size") + 'clsgeom_linerange.strGeomName = "geom_linerange" + ''mandatory + 'clsgeom_linerange.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_linerange.AddAesParameter("ymax", bIsMandatory:=True) + 'clsgeom_linerange.AddAesParameter("ymin", bIsMandatory:=True) + ''optional + 'clsgeom_linerange.AddAesParameter("alpha") + 'clsgeom_linerange.AddAesParameter("colour") + 'clsgeom_linerange.AddAesParameter("linetype") + 'clsgeom_linerange.AddAesParameter("size") - 'adding layer parameters - clsgeom_linerange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_linerange) + ''adding layer parameters + 'clsgeom_linerange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_linerange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_linerange) - clsgeom_map.strGeomName = "geom_map" - 'mandatory - clsgeom_map.AddAesParameter("map_id", bIsMandatory:=True) - 'optional - clsgeom_map.AddAesParameter("alpha") - clsgeom_map.AddAesParameter("colour") - clsgeom_map.AddAesParameter("fill") - clsgeom_map.AddAesParameter("linetype") - clsgeom_map.AddAesParameter("size") + 'clsgeom_map.strGeomName = "geom_map" + ''mandatory + 'clsgeom_map.AddAesParameter("map_id", bIsMandatory:=True) + ''optional + 'clsgeom_map.AddAesParameter("alpha") + 'clsgeom_map.AddAesParameter("colour") + 'clsgeom_map.AddAesParameter("fill") + 'clsgeom_map.AddAesParameter("linetype") + 'clsgeom_map.AddAesParameter("size") - 'adding layer parameters - clsgeom_map.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_map) + ''adding layer parameters + 'clsgeom_map.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_map) - clsgeom_path.strGeomName = "geom_path" - 'mandatory - clsgeom_path.AddAesParameter("x", bIsMandatory:=True) - clsgeom_path.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_path.AddAesParameter("alpha") - clsgeom_path.AddAesParameter("colour") - clsgeom_path.AddAesParameter("linetype") - clsgeom_path.AddAesParameter("size") - 'add layer parameters - clsgeom_path.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) - clsgeom_path.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_path.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_path.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) - 'linemitre should 1 or a number >1 - clsgeom_path.AddLayerParameter("linemitre", "numeric", "1") - lstAllGeoms.Add(clsgeom_path) + 'clsgeom_path.strGeomName = "geom_path" + ''mandatory + 'clsgeom_path.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_path.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_path.AddAesParameter("alpha") + 'clsgeom_path.AddAesParameter("colour") + 'clsgeom_path.AddAesParameter("linetype") + 'clsgeom_path.AddAesParameter("size") + ''add layer parameters + 'clsgeom_path.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_path.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_path.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_path.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_path.AddLayerParameter("linemitre", "numeric", "1") + 'lstAllGeoms.Add(clsgeom_path) clsgeom_point.strGeomName = "geom_point" 'mandatory @@ -582,253 +582,253 @@ Public Class ucrGeom clsgeom_point.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34)}) lstAllGeoms.Add(clsgeom_point) - clsgeom_pointrange.strGeomName = "geom_pointrange" - clsgeom_pointrange.AddAesParameter("x", bIsMandatory:=True) - clsgeom_pointrange.AddAesParameter("ymax", bIsMandatory:=True) - clsgeom_pointrange.AddAesParameter("ymin", bIsMandatory:=True) - 'optional - clsgeom_pointrange.AddAesParameter("alpha") - clsgeom_pointrange.AddAesParameter("colour") - clsgeom_pointrange.AddAesParameter("linetype") - clsgeom_pointrange.AddAesParameter("size") - 'adding layer parameters - clsgeom_pointrange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_pointrange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - - lstAllGeoms.Add(clsgeom_pointrange) - - clsgeom_polygon.strGeomName = "geom_polygon" - clsgeom_polygon.AddAesParameter("x", bIsMandatory:=True) - clsgeom_polygon.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_polygon.AddAesParameter("alpha") - clsgeom_polygon.AddAesParameter("colour") - clsgeom_polygon.AddAesParameter("fill") - clsgeom_polygon.AddAesParameter("linetype") - clsgeom_polygon.AddAesParameter("size") - 'add layer parameters - clsgeom_polygon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_polygon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_polygon) - - 'clsgeom_qq.strGeomName = "geom_qq" - 'clsgeom_qq.AddAesParameter("sample", bIsMandatory:=True) + 'clsgeom_pointrange.strGeomName = "geom_pointrange" + 'clsgeom_pointrange.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_pointrange.AddAesParameter("ymax", bIsMandatory:=True) + 'clsgeom_pointrange.AddAesParameter("ymin", bIsMandatory:=True) ''optional - 'clsgeom_qq.AddAesParameter("x") - 'clsgeom_qq.AddAesParameter("y") - 'lstAllGeoms.Add(clsgeom_qq) - - clsgeom_quantile.strGeomName = "geom_quantile" - clsgeom_quantile.AddAesParameter("x", bIsMandatory:=True) - clsgeom_quantile.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_quantile.AddAesParameter("alpha") - clsgeom_quantile.AddAesParameter("colour") - clsgeom_quantile.AddAesParameter("linetype") - clsgeom_quantile.AddAesParameter("size") - clsgeom_quantile.AddAesParameter("weight") - - 'adding layer parameter - clsgeom_quantile.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) - clsgeom_quantile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_quantile.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_quantile.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) - 'linemitre should 1 or a number >1 - clsgeom_quantile.AddLayerParameter("linemitre", "numeric", "1") - lstAllGeoms.Add(clsgeom_quantile) - - clsgeom_raster.strGeomName = "geom_raster" - 'mandatory - clsgeom_raster.AddAesParameter("x", bIsMandatory:=True) - clsgeom_raster.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_raster.AddAesParameter("alpha") - clsgeom_raster.AddAesParameter("colour") - clsgeom_raster.AddAesParameter("fill") - clsgeom_raster.AddAesParameter("linetype") - clsgeom_raster.AddAesParameter("size") - - 'add layer parameter - clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_raster.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_raster.AddLayerParameter("hjust", "numeric", "0.5") - clsgeom_raster.AddLayerParameter("vjust", "numeric", "0.5") - - lstAllGeoms.Add(clsgeom_raster) - - clsgeom_rect.strGeomName = "geom_rect" - 'mandatory - clsgeom_rect.AddAesParameter("x", bIsMandatory:=True) - clsgeom_rect.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_rect.AddAesParameter("alpha") - clsgeom_rect.AddAesParameter("colour") - clsgeom_rect.AddAesParameter("fill") - clsgeom_rect.AddAesParameter("linetype") - clsgeom_rect.AddAesParameter("size") - - 'clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_rect.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_rect.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_rect) - - clsgeom_ribbon.strGeomName = "geom_ribbon" - clsgeom_ribbon.AddAesParameter("x", bIsMandatory:=True) - clsgeom_ribbon.AddAesParameter("ymax", bIsMandatory:=True) - clsgeom_ribbon.AddAesParameter("ymin", bIsMandatory:=True) - 'optional - clsgeom_ribbon.AddAesParameter("alpha") - clsgeom_ribbon.AddAesParameter("colour") - clsgeom_ribbon.AddAesParameter("linetype") - clsgeom_ribbon.AddAesParameter("size") - - 'add layer parameter - clsgeom_ribbon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_ribbon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_ribbon) - - clsgeom_rug.strGeomName = "geom_rug" - clsgeom_rug.AddAesParameter("alpha") - clsgeom_rug.AddAesParameter("colour") - clsgeom_rug.AddAesParameter("linetype") - clsgeom_rug.AddAesParameter("size") - - 'adding layer parameters - clsgeom_rug.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_rug.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_rug) - - clsgeom_segment.strGeomName = "geom_segment" - 'mandatory - clsgeom_segment.AddAesParameter("x", bIsMandatory:=True) - clsgeom_segment.AddAesParameter("xend", bIsMandatory:=True) - clsgeom_segment.AddAesParameter("y", bIsMandatory:=True) - clsgeom_segment.AddAesParameter("yend", bIsMandatory:=True) - 'optional - clsgeom_segment.AddAesParameter("alpha") - clsgeom_segment.AddAesParameter("colour") - clsgeom_segment.AddAesParameter("linetype") - clsgeom_segment.AddAesParameter("size") - 'add layer parameter - clsgeom_segment.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_segment.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_segment.AddLayerParameter("hjust", "numeric", "0.5") - clsgeom_segment.AddLayerParameter("vjust", "numeric", "0.5") - lstAllGeoms.Add(clsgeom_segment) - - 'clsgeom_smooth.strGeomName = "geom_smooth" + 'clsgeom_pointrange.AddAesParameter("alpha") + 'clsgeom_pointrange.AddAesParameter("colour") + 'clsgeom_pointrange.AddAesParameter("linetype") + 'clsgeom_pointrange.AddAesParameter("size") + ''adding layer parameters + 'clsgeom_pointrange.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_pointrange.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + + 'lstAllGeoms.Add(clsgeom_pointrange) + + 'clsgeom_polygon.strGeomName = "geom_polygon" + 'clsgeom_polygon.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_polygon.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_polygon.AddAesParameter("alpha") + 'clsgeom_polygon.AddAesParameter("colour") + 'clsgeom_polygon.AddAesParameter("fill") + 'clsgeom_polygon.AddAesParameter("linetype") + 'clsgeom_polygon.AddAesParameter("size") + ''add layer parameters + 'clsgeom_polygon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_polygon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_polygon) + + ''clsgeom_qq.strGeomName = "geom_qq" + ''clsgeom_qq.AddAesParameter("sample", bIsMandatory:=True) + '''optional + ''clsgeom_qq.AddAesParameter("x") + ''clsgeom_qq.AddAesParameter("y") + ''lstAllGeoms.Add(clsgeom_qq) + + 'clsgeom_quantile.strGeomName = "geom_quantile" + 'clsgeom_quantile.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_quantile.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_quantile.AddAesParameter("alpha") + 'clsgeom_quantile.AddAesParameter("colour") + 'clsgeom_quantile.AddAesParameter("linetype") + 'clsgeom_quantile.AddAesParameter("size") + 'clsgeom_quantile.AddAesParameter("weight") + + ''adding layer parameter + 'clsgeom_quantile.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_quantile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_quantile.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_quantile.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_quantile.AddLayerParameter("linemitre", "numeric", "1") + 'lstAllGeoms.Add(clsgeom_quantile) + + 'clsgeom_raster.strGeomName = "geom_raster" ''mandatory - 'clsgeom_smooth.AddAesParameter("x", bIsMandatory:=True) - 'clsgeom_smooth.AddAesParameter("y", bIsMandatory:=True) - ''optional - 'clsgeom_smooth.AddAesParameter("alpha") - 'clsgeom_smooth.AddAesParameter("colour") - 'clsgeom_smooth.AddAesParameter("fill") - 'clsgeom_smooth.AddAesParameter("linetype") - 'clsgeom_smooth.AddAesParameter("size") - 'clsgeom_smooth.AddAesParameter("weight") - 'lstAllGeoms.Add(clsgeom_smooth) - - clsgeom_spoke.strGeomName = "geom_spoke" - 'mandatory - clsgeom_spoke.AddAesParameter("angle", bIsMandatory:=True) - clsgeom_spoke.AddAesParameter("radius", bIsMandatory:=True) - clsgeom_spoke.AddAesParameter("x", bIsMandatory:=True) - clsgeom_spoke.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_spoke.AddAesParameter("alpha") - clsgeom_spoke.AddAesParameter("colour") - clsgeom_spoke.AddAesParameter("linetype") - clsgeom_spoke.AddAesParameter("size") - - 'add layer parameter - clsgeom_spoke.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_spoke) - - clsgeom_step.strGeomName = "geom_step" - clsgeom_step.AddAesParameter("x", bIsMandatory:=True) - clsgeom_step.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_step.AddAesParameter("alpha") - clsgeom_step.AddAesParameter("colour") - clsgeom_step.AddAesParameter("linetype") - clsgeom_step.AddAesParameter("size") - - 'adding layer parameter - clsgeom_step.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) - clsgeom_step.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_step.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) - clsgeom_step.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) - 'linemitre should 1 or a number >1 - clsgeom_step.AddLayerParameter("linemitre", "numeric", "1") - lstAllGeoms.Add(clsgeom_step) - - clsgeom_text.strGeomName = "geom_text" - 'mandatory - clsgeom_text.AddAesParameter("label", bIsMandatory:=True) - clsgeom_text.AddAesParameter("x", bIsMandatory:=True) - clsgeom_text.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_text.AddAesParameter("alpha") - clsgeom_text.AddAesParameter("colour") - clsgeom_text.AddAesParameter("family") - clsgeom_text.AddAesParameter("fontface") - clsgeom_text.AddAesParameter("hjust") - clsgeom_text.AddAesParameter("lineheight") - 'TO DO add size and vjust this might need additon of labels and receivers - + 'clsgeom_raster.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_raster.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_raster.AddAesParameter("alpha") + 'clsgeom_raster.AddAesParameter("colour") + 'clsgeom_raster.AddAesParameter("fill") + 'clsgeom_raster.AddAesParameter("linetype") + 'clsgeom_raster.AddAesParameter("size") - 'adding layer parameters - clsgeom_text.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_text.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_text.AddLayerParameter("parse", "bolean", "FALSE") - clsgeom_text.AddLayerParameter("nudge_x", "numeric", "0") - clsgeom_text.AddLayerParameter("nudge_y", "numeric", "0") - clsgeom_text.AddLayerParameter("check_overlap", "bolean", "FALSE") - lstAllGeoms.Add(clsgeom_text) - - clsgeom_tile.strGeomName = "geom_tile" - 'mandatory - clsgeom_tile.AddAesParameter("x", bIsMandatory:=True) - clsgeom_tile.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_tile.AddAesParameter("alpha") - clsgeom_tile.AddAesParameter("colour") - clsgeom_tile.AddAesParameter("fill") - clsgeom_tile.AddAesParameter("linetype") - clsgeom_tile.AddAesParameter("size") + ''add layer parameter + 'clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_raster.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_raster.AddLayerParameter("hjust", "numeric", "0.5") + 'clsgeom_raster.AddLayerParameter("vjust", "numeric", "0.5") - 'add layer parameters - clsgeom_tile.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) - clsgeom_tile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) - lstAllGeoms.Add(clsgeom_tile) + 'lstAllGeoms.Add(clsgeom_raster) - clsgeom_violin.strGeomName = "geom_violin" - 'mandatory - clsgeom_violin.AddAesParameter("x", bIsMandatory:=True) - clsgeom_violin.AddAesParameter("y", bIsMandatory:=True) - 'optional - clsgeom_violin.AddAesParameter("alpha") - clsgeom_violin.AddAesParameter("colour") - clsgeom_violin.AddAesParameter("fill") - clsgeom_violin.AddAesParameter("linetype") - clsgeom_violin.AddAesParameter("size") - clsgeom_violin.AddAesParameter("weight") - 'add layer parameter - clsgeom_violin.AddLayerParameter("stat", "list", Chr(34) & "ydensity" & Chr(34)) - clsgeom_violin.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) - lstAllGeoms.Add(clsgeom_violin) - - clsgeom_vline.strGeomName = "geom_vline" - clsgeom_vline.AddAesParameter("alpha") - clsgeom_vline.AddAesParameter("colour") - clsgeom_vline.AddAesParameter("linetype") - clsgeom_vline.AddAesParameter("size") - 'TO DO include those that control position - 'add layer parameter - clsgeom_vline.AddLayerParameter("xintercept", "numeric", "0") - lstAllGeoms.Add(clsgeom_vline) + 'clsgeom_rect.strGeomName = "geom_rect" + ''mandatory + 'clsgeom_rect.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_rect.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_rect.AddAesParameter("alpha") + 'clsgeom_rect.AddAesParameter("colour") + 'clsgeom_rect.AddAesParameter("fill") + 'clsgeom_rect.AddAesParameter("linetype") + 'clsgeom_rect.AddAesParameter("size") + + ''clsgeom_raster.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_rect.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_rect.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_rect) + + 'clsgeom_ribbon.strGeomName = "geom_ribbon" + 'clsgeom_ribbon.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_ribbon.AddAesParameter("ymax", bIsMandatory:=True) + 'clsgeom_ribbon.AddAesParameter("ymin", bIsMandatory:=True) + ''optional + 'clsgeom_ribbon.AddAesParameter("alpha") + 'clsgeom_ribbon.AddAesParameter("colour") + 'clsgeom_ribbon.AddAesParameter("linetype") + 'clsgeom_ribbon.AddAesParameter("size") + + ''add layer parameter + 'clsgeom_ribbon.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_ribbon.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_ribbon) + + 'clsgeom_rug.strGeomName = "geom_rug" + 'clsgeom_rug.AddAesParameter("alpha") + 'clsgeom_rug.AddAesParameter("colour") + 'clsgeom_rug.AddAesParameter("linetype") + 'clsgeom_rug.AddAesParameter("size") + + ''adding layer parameters + 'clsgeom_rug.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_rug.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_rug) + + 'clsgeom_segment.strGeomName = "geom_segment" + ''mandatory + 'clsgeom_segment.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_segment.AddAesParameter("xend", bIsMandatory:=True) + 'clsgeom_segment.AddAesParameter("y", bIsMandatory:=True) + 'clsgeom_segment.AddAesParameter("yend", bIsMandatory:=True) + ''optional + 'clsgeom_segment.AddAesParameter("alpha") + 'clsgeom_segment.AddAesParameter("colour") + 'clsgeom_segment.AddAesParameter("linetype") + 'clsgeom_segment.AddAesParameter("size") + ''add layer parameter + 'clsgeom_segment.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_segment.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_segment.AddLayerParameter("hjust", "numeric", "0.5") + 'clsgeom_segment.AddLayerParameter("vjust", "numeric", "0.5") + 'lstAllGeoms.Add(clsgeom_segment) + + ''clsgeom_smooth.strGeomName = "geom_smooth" + '''mandatory + ''clsgeom_smooth.AddAesParameter("x", bIsMandatory:=True) + ''clsgeom_smooth.AddAesParameter("y", bIsMandatory:=True) + '''optional + ''clsgeom_smooth.AddAesParameter("alpha") + ''clsgeom_smooth.AddAesParameter("colour") + ''clsgeom_smooth.AddAesParameter("fill") + ''clsgeom_smooth.AddAesParameter("linetype") + ''clsgeom_smooth.AddAesParameter("size") + ''clsgeom_smooth.AddAesParameter("weight") + ''lstAllGeoms.Add(clsgeom_smooth) + + 'clsgeom_spoke.strGeomName = "geom_spoke" + ''mandatory + 'clsgeom_spoke.AddAesParameter("angle", bIsMandatory:=True) + 'clsgeom_spoke.AddAesParameter("radius", bIsMandatory:=True) + 'clsgeom_spoke.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_spoke.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_spoke.AddAesParameter("alpha") + 'clsgeom_spoke.AddAesParameter("colour") + 'clsgeom_spoke.AddAesParameter("linetype") + 'clsgeom_spoke.AddAesParameter("size") + + ''add layer parameter + 'clsgeom_spoke.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_spoke.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_spoke) + + 'clsgeom_step.strGeomName = "geom_step" + 'clsgeom_step.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_step.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_step.AddAesParameter("alpha") + 'clsgeom_step.AddAesParameter("colour") + 'clsgeom_step.AddAesParameter("linetype") + 'clsgeom_step.AddAesParameter("size") + + ''adding layer parameter + 'clsgeom_step.AddLayerParameter("stat", "list", Chr(34) & "contour" & Chr(34)) + 'clsgeom_step.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_step.AddLayerParameter("lineend", "list", Chr(34) & "butt" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "butt" & Chr(34), Chr(34) & "square" & Chr(34)}) + 'clsgeom_step.AddLayerParameter("linejoin", "list", Chr(34) & "round" & Chr(34), lstParameterStrings:={Chr(34) & "round" & Chr(34), Chr(34) & "mitre" & Chr(34), Chr(34) & "bevel" & Chr(34)}) + ''linemitre should 1 or a number >1 + 'clsgeom_step.AddLayerParameter("linemitre", "numeric", "1") + 'lstAllGeoms.Add(clsgeom_step) + + 'clsgeom_text.strGeomName = "geom_text" + ''mandatory + 'clsgeom_text.AddAesParameter("label", bIsMandatory:=True) + 'clsgeom_text.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_text.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_text.AddAesParameter("alpha") + 'clsgeom_text.AddAesParameter("colour") + 'clsgeom_text.AddAesParameter("family") + 'clsgeom_text.AddAesParameter("fontface") + 'clsgeom_text.AddAesParameter("hjust") + 'clsgeom_text.AddAesParameter("lineheight") + ''TO DO add size and vjust this might need additon of labels and receivers + + + ''adding layer parameters + 'clsgeom_text.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_text.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_text.AddLayerParameter("parse", "bolean", "FALSE") + 'clsgeom_text.AddLayerParameter("nudge_x", "numeric", "0") + 'clsgeom_text.AddLayerParameter("nudge_y", "numeric", "0") + 'clsgeom_text.AddLayerParameter("check_overlap", "bolean", "FALSE") + 'lstAllGeoms.Add(clsgeom_text) + + 'clsgeom_tile.strGeomName = "geom_tile" + ''mandatory + 'clsgeom_tile.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_tile.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_tile.AddAesParameter("alpha") + 'clsgeom_tile.AddAesParameter("colour") + 'clsgeom_tile.AddAesParameter("fill") + 'clsgeom_tile.AddAesParameter("linetype") + 'clsgeom_tile.AddAesParameter("size") + + ''add layer parameters + 'clsgeom_tile.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34)) + 'clsgeom_tile.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_tile) + + 'clsgeom_violin.strGeomName = "geom_violin" + ''mandatory + 'clsgeom_violin.AddAesParameter("x", bIsMandatory:=True) + 'clsgeom_violin.AddAesParameter("y", bIsMandatory:=True) + ''optional + 'clsgeom_violin.AddAesParameter("alpha") + 'clsgeom_violin.AddAesParameter("colour") + 'clsgeom_violin.AddAesParameter("fill") + 'clsgeom_violin.AddAesParameter("linetype") + 'clsgeom_violin.AddAesParameter("size") + 'clsgeom_violin.AddAesParameter("weight") + ''add layer parameter + 'clsgeom_violin.AddLayerParameter("stat", "list", Chr(34) & "ydensity" & Chr(34)) + 'clsgeom_violin.AddLayerParameter("position", "list", Chr(34) & "dodge" & Chr(34)) + 'lstAllGeoms.Add(clsgeom_violin) + + 'clsgeom_vline.strGeomName = "geom_vline" + 'clsgeom_vline.AddAesParameter("alpha") + 'clsgeom_vline.AddAesParameter("colour") + 'clsgeom_vline.AddAesParameter("linetype") + 'clsgeom_vline.AddAesParameter("size") + ''TO DO include those that control position + ''add layer parameter + 'clsgeom_vline.AddLayerParameter("xintercept", "numeric", "0") + 'lstAllGeoms.Add(clsgeom_vline) End Sub Public Event GeomChanged(sender As Object, e As EventArgs) Private Sub cboGeomList_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboGeomList.SelectedIndexChanged From e213b613ff5f8b60aef967395ecd58a6f3e47d71 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 11 Oct 2016 15:21:59 +0300 Subject: [PATCH 20/37] # Factor data frame design --- dlgFactorDataFrame.vb | 5 ++ instat/dlgFactorDataFrame.Designer.vb | 89 +++++++++++++++++++++++---- instat/dlgFactorDataFrame.vb | 41 +----------- 3 files changed, 82 insertions(+), 53 deletions(-) create mode 100644 dlgFactorDataFrame.vb diff --git a/dlgFactorDataFrame.vb b/dlgFactorDataFrame.vb new file mode 100644 index 00000000000..dc8783c41c9 --- /dev/null +++ b/dlgFactorDataFrame.vb @@ -0,0 +1,5 @@ +Imports Microsoft.VisualBasic + +Public Class Class1 + +End Class diff --git a/instat/dlgFactorDataFrame.Designer.vb b/instat/dlgFactorDataFrame.Designer.vb index b7b458ed7a8..930db3ef903 100644 --- a/instat/dlgFactorDataFrame.Designer.vb +++ b/instat/dlgFactorDataFrame.Designer.vb @@ -1,9 +1,9 @@ - + _ Partial Class dlgFactorDataFrame Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. - + _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then @@ -20,34 +20,97 @@ Partial Class dlgFactorDataFrame 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. - + _ Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() + Me.ucrSelectorFactorDataFrame = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrReceiverFactorDataFrame = New instat.ucrReceiverSingle() + Me.chkReplaceFactorSheet = New System.Windows.Forms.CheckBox() + Me.chkAddCurrentContrast = New System.Windows.Forms.CheckBox() + Me.ucrButtons = New instat.ucrButtons() + Me.lblSelectedFactor = New System.Windows.Forms.Label() Me.SuspendLayout() ' - 'ucrBase + 'ucrSelectorFactorDataFrame ' - Me.ucrBase.Location = New System.Drawing.Point(13, 196) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(410, 53) - Me.ucrBase.TabIndex = 0 + Me.ucrSelectorFactorDataFrame.bShowHiddenColumns = False + Me.ucrSelectorFactorDataFrame.bUseCurrentFilter = False + Me.ucrSelectorFactorDataFrame.Location = New System.Drawing.Point(9, 9) + Me.ucrSelectorFactorDataFrame.Margin = New System.Windows.Forms.Padding(0) + Me.ucrSelectorFactorDataFrame.Name = "ucrSelectorFactorDataFrame" + Me.ucrSelectorFactorDataFrame.Size = New System.Drawing.Size(210, 180) + Me.ucrSelectorFactorDataFrame.TabIndex = 0 + ' + 'ucrReceiverFactorDataFrame + ' + Me.ucrReceiverFactorDataFrame.Location = New System.Drawing.Point(256, 111) + Me.ucrReceiverFactorDataFrame.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverFactorDataFrame.Name = "ucrReceiverFactorDataFrame" + Me.ucrReceiverFactorDataFrame.Selector = Nothing + Me.ucrReceiverFactorDataFrame.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverFactorDataFrame.TabIndex = 1 + ' + 'chkReplaceFactorSheet + ' + Me.chkReplaceFactorSheet.AutoSize = True + Me.chkReplaceFactorSheet.Location = New System.Drawing.Point(247, 47) + Me.chkReplaceFactorSheet.Name = "chkReplaceFactorSheet" + Me.chkReplaceFactorSheet.Size = New System.Drawing.Size(166, 17) + Me.chkReplaceFactorSheet.TabIndex = 2 + Me.chkReplaceFactorSheet.Text = "Replace current Factor Sheet" + Me.chkReplaceFactorSheet.UseVisualStyleBackColor = True + ' + 'chkAddCurrentContrast + ' + Me.chkAddCurrentContrast.AutoSize = True + Me.chkAddCurrentContrast.Location = New System.Drawing.Point(247, 16) + Me.chkAddCurrentContrast.Name = "chkAddCurrentContrast" + Me.chkAddCurrentContrast.Size = New System.Drawing.Size(129, 17) + Me.chkAddCurrentContrast.TabIndex = 2 + Me.chkAddCurrentContrast.Text = "Add Current Contrasts" + Me.chkAddCurrentContrast.UseVisualStyleBackColor = True + ' + 'ucrButtons + ' + Me.ucrButtons.Location = New System.Drawing.Point(9, 208) + Me.ucrButtons.Name = "ucrButtons" + Me.ucrButtons.Size = New System.Drawing.Size(410, 52) + Me.ucrButtons.TabIndex = 3 + ' + 'lblSelectedFactor + ' + Me.lblSelectedFactor.AutoSize = True + Me.lblSelectedFactor.Location = New System.Drawing.Point(253, 95) + Me.lblSelectedFactor.Name = "lblSelectedFactor" + Me.lblSelectedFactor.Size = New System.Drawing.Size(120, 13) + Me.lblSelectedFactor.TabIndex = 4 + Me.lblSelectedFactor.Text = "Selected Factor Column" ' 'dlgFactorDataFrame ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(435, 261) - Me.Controls.Add(Me.ucrBase) + Me.ClientSize = New System.Drawing.Size(421, 268) + Me.Controls.Add(Me.lblSelectedFactor) + Me.Controls.Add(Me.ucrButtons) + Me.Controls.Add(Me.chkAddCurrentContrast) + Me.Controls.Add(Me.chkReplaceFactorSheet) + Me.Controls.Add(Me.ucrReceiverFactorDataFrame) + Me.Controls.Add(Me.ucrSelectorFactorDataFrame) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgFactorDataFrame" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Tag = "Factor_Data_Frame" Me.Text = "Factor Data Frame" Me.ResumeLayout(False) + Me.PerformLayout() End Sub - Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrSelectorFactorDataFrame As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrReceiverFactorDataFrame As ucrReceiverSingle + Friend WithEvents chkReplaceFactorSheet As CheckBox + Friend WithEvents chkAddCurrentContrast As CheckBox + Friend WithEvents ucrButtons As ucrButtons + Friend WithEvents lblSelectedFactor As Label End Class diff --git a/instat/dlgFactorDataFrame.vb b/instat/dlgFactorDataFrame.vb index 3457ca2051f..66e4f4d7681 100644 --- a/instat/dlgFactorDataFrame.vb +++ b/instat/dlgFactorDataFrame.vb @@ -1,42 +1,3 @@ -' Instat-R -' Copyright (C) 2015 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License k -' along with this program. If not, see . -Imports instat.Translations +Public Class dlgFactorDataFrame -Public Class dlgFactorDataFrame - Public bFirstLoad As Boolean = True - - Private Sub dlgFactorDataFrame_Load(sender As Object, e As EventArgs) Handles MyBase.Load - autoTranslate(Me) - - If bFirstLoad Then - InitialiseDialog() - SetDefaults() - bFirstLoad = False - End If - End Sub - - Private Sub InitialiseDialog() - ucrBase.iHelpTopicID = 162 - - End Sub - Private Sub SetDefaults() - - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - End Sub End Class \ No newline at end of file From ca032a9e6fdc167601f97239f9542c3dd21ae2ea Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 11 Oct 2016 15:38:40 +0300 Subject: [PATCH 21/37] #Change on specify origin - date format --- instat/dlgMakeDate.vb | 240 +++++++++++++++++++++--------------------- 1 file changed, 119 insertions(+), 121 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index 3f071430a99..16d78b15f41 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -16,17 +16,18 @@ Imports instat.Translations Public Class dlgMakeDate + Public clsPaste As New RFunction Public bFirstLoad As Boolean = True Private Sub ucrSeclectorMakeDate_Load(sender As Object, e As EventArgs) Handles ucrSeclectorMakeDate.Load If bFirstLoad Then - InitialiseDialog() + InitialiseDialog() SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - TestOKEnabled() - autoTranslate(Me) + bFirstLoad = False + Else + ReopenDialog() + End If + TestOKEnabled() + autoTranslate(Me) End Sub @@ -41,16 +42,12 @@ Public Class dlgMakeDate ucrInputDay.SetItems({"%d (1-31)", "%j (1-366)"}) ucrInputComboBoxMonthTwo.SetItems({"365/366", "366"}) ucrInputComboBoxYearTwo.SetItems({"4 digits", "2 digits"}) - ucrInputFormat.SetItems({"%Y-%m-%d", "%d/%m/%Y", "%d%m%Y"}) + ucrInputFormat.SetItems({"%Y-%m-%d", "%Y/%m/%d", "%d%m%Y"}) ucrInputComboBoxTearThree.SetItems({"4 digits", "2 digits"}) - ucrInputOrigin.SetItems({"1899-12-30 (Excel)", "1600-03-01 (Gregorian)"}) - ucrReceiverForDate.Selector = ucrSeclectorMakeDate - ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate - ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate - ucrReceiverYearThree.Selector = ucrSeclectorMakeDate - ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate - ucrReceiverDayThree.Selector = ucrSeclectorMakeDate + ucrInputOrigin.SetItems({"30-12-1899 (Excel)", "01-03-1600 (Gregorian)"}) + ucrBase.clsRsyntax.SetFunction("as.Date") + ucrBase.clsRsyntax.AddParameter("x") End Sub Private Sub SetDefaults() @@ -59,7 +56,7 @@ Public Class dlgMakeDate ucrInputNewColumnName.Reset() ucrSeclectorMakeDate.Reset() ucrInputFormat.Reset() - ucrInputFormat.SetName("%d/%m/%Y") + ucrInputFormat.SetName("%Y-%m-%d") ucrInputSeparator.SetName("/") ucrInputYear.SetName("%Y (4 digits)") ucrInputMonth.SetName("%m (1-12)") @@ -67,12 +64,13 @@ Public Class dlgMakeDate ucrInputComboBoxTearThree.SetName("4 digits (eg 1920)") ucrInputComboBoxMonthTwo.SetName("365/366") ucrInputComboBoxYearTwo.SetName("4 digits (eg 1920)") - ucrInputOrigin.SetName("1899-12-30 (Excel)") + ucrInputOrigin.SetName("30-12-1899 (Excel)") grpFormatField.Visible = False ucrInputOrigin.Visible = False ucrInputNewColumnName.SetPrefix("Date") TestOKEnabled() rdoSingleColumn.Checked = True + ShowGroups() End Sub Private Sub TestOKEnabled() If ((Not ucrReceiverForDate.IsEmpty) OrElse ((Not ucrReceiverYearTwo.IsEmpty) AndAlso (Not ucrReceiverDayTwo.IsEmpty)) OrElse ((Not ucrReceiverDayThree.IsEmpty) AndAlso (Not ucrReceiverMonthThree.IsEmpty) AndAlso (Not ucrReceiverYearThree.IsEmpty))) Then @@ -81,6 +79,14 @@ Public Class dlgMakeDate ucrBase.OKEnabled(False) End If End Sub + Private Sub DateFormat() + Select Case ucrInputOrigin.GetText + Case "30-12-1899 (Excel)" + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30(Excel)" & Chr(34)) + Case Else + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03 (Gregorian)" & Chr(34)) + End Select + End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk If Not ucrInputFormat.cboInput.Items.Contains(ucrInputFormat.GetText) Then @@ -100,18 +106,88 @@ Public Class dlgMakeDate Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() End Sub - Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged, ucrReceiverDayThree.SelectionChanged, ucrReceiverDayTwo.SelectionChanged, ucrReceiverMonthThree.SelectionChanged, ucrReceiverYearThree.SelectionChanged, ucrReceiverYearTwo.SelectionChanged - Formats() + Private Sub ucrReceiverForDate_SelectionChanged(sender As Object, e As EventArgs) Handles ucrReceiverForDate.SelectionChanged + DateCols() TestOKEnabled() End Sub - Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged, rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged, rdoDefaultFormat.CheckedChanged + Private Sub DateCols() + If rdoSingleColumn.Checked Then + If Not ucrReceiverForDate.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) + + Else + ucrBase.clsRsyntax.RemoveParameter("x") + End If + ElseIf rdoYearandDayofYear.Checked Then + + Else + + If Not ucrReceiverMonthThree.IsEmpty AndAlso Not ucrReceiverDayThree.IsEmpty AndAlso Not ucrReceiverYearThree.IsEmpty Then + + clsPaste.SetRCommand("paste") + clsPaste.AddParameter("sep", Chr(34) & "" & Chr(34)) + clsPaste.AddParameter("x") + End If + End If + End Sub + + Private Sub ucrReceiverForDate_Load(sender As Object, e As EventArgs) + + End Sub + + Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged + ShowGroups() + End Sub + + Private Sub ShowGroups() + If rdoSingleColumn.Checked Then + ucrReceiverForDate.Selector = ucrSeclectorMakeDate + ucrReceiverForDate.SetMeAsReceiver() + grpSingleColumn.Visible = True + grpTwoColumns.Visible = False + grpThreeColumns.Visible = False + ElseIf rdoYearandDayofYear.Checked Then + ucrReceiverYearTwo.Selector = ucrSeclectorMakeDate + ucrReceiverDayTwo.Selector = ucrSeclectorMakeDate + ucrReceiverYearTwo.SetMeAsReceiver() + grpTwoColumns.Visible = True + grpThreeColumns.Visible = False + grpSingleColumn.Visible = False + Else + ucrReceiverYearThree.Selector = ucrSeclectorMakeDate + ucrReceiverMonthThree.Selector = ucrSeclectorMakeDate + ucrReceiverDayThree.Selector = ucrSeclectorMakeDate + ucrReceiverYearThree.SetMeAsReceiver() + grpThreeColumns.Visible = True + grpTwoColumns.Visible = False + grpSingleColumn.Visible = False + End If + End Sub + Private Sub ShowOrigin() + If rdoSpecifyOrigin.Checked Then + ucrInputOrigin.Visible = True + Else + ucrInputOrigin.Visible = False + End If + End Sub + + Private Sub showFormat() + If chkMore.Checked Then + grpFormatField.Visible = True + Else + grpFormatField.Visible = False + End If + End Sub + + Private Sub rdoSpecifyOrigin_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSpecifyOrigin.CheckedChanged, rdoSpecifyFormat.CheckedChanged + ShowOrigin() Formats() - TestOKEnabled() End Sub + Private Sub chkMore_CheckedChanged(sender As Object, e As EventArgs) Handles chkMore.CheckedChanged - Formats() + showFormat() End Sub Private Sub ucrInputSpecifyDates_NameChanged() Handles ucrInputFormat.NameChanged @@ -119,120 +195,42 @@ Public Class dlgMakeDate End Sub Private Sub ucrSeclectorMakeDate_DataFrameChanged() Handles ucrSeclectorMakeDate.DataFrameChanged - Formats() + End Sub Private Sub ucrInputOrigin_NameChanged() Handles ucrInputOrigin.NameChanged Formats() + If Not ucrInputOrigin.IsEmpty Then + DateFormat() + Else + ucrBase.clsRsyntax.RemoveParameter("origin") + End If + End Sub Private Sub Formats() - If rdoSingleColumn.Checked Then - - ucrReceiverForDate.SetMeAsReceiver() - grpSingleColumn.Visible = True - grpTwoColumns.Visible = False - grpThreeColumns.Visible = False - ucrBase.clsRsyntax.SetFunction("as.Date") - If chkMore.Checked Then - grpFormatField.Visible = True - Else - grpFormatField.Visible = False - End If - If Not ucrReceiverForDate.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverForDate.GetVariables()) - - Else - ucrBase.clsRsyntax.RemoveParameter("x") - End If - If rdoSpecifyOrigin.Checked Then - ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) - ucrInputFormat.Visible = False - ucrInputOrigin.Visible = True - ucrBase.clsRsyntax.RemoveParameter("format") - If Not ucrInputOrigin.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & ucrInputOrigin.GetText & Chr(34)) - Else - ucrBase.clsRsyntax.RemoveParameter("origin") - - - End If - ElseIf rdoSpecifyFormat.Checked Then - ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) - - ucrBase.clsRsyntax.RemoveParameter("origin") - ucrInputFormat.Visible = True - ucrInputOrigin.Visible = False - - If Not ucrInputFormat.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) - Else - ucrBase.clsRsyntax.RemoveParameter("format") - End If - Else - ucrInputOrigin.Visible = False - ucrInputFormat.Visible = False - ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) - ucrBase.clsRsyntax.RemoveParameter("format") - ucrBase.clsRsyntax.RemoveParameter("origin") - End If - ucrBase.clsRsyntax.RemoveParameter("year") - ucrBase.clsRsyntax.RemoveParameter("doy") - ucrBase.clsRsyntax.RemoveParameter("month") - ucrBase.clsRsyntax.RemoveParameter("day") - ucrBase.clsRsyntax.RemoveParameter("data_name") - ElseIf rdoYearandDayofYear.Checked Then - ucrReceiverYearTwo.SetMeAsReceiver() - ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - ucrBase.clsRsyntax.RemoveParameter("x") + If rdoSpecifyOrigin.Checked Then + ucrInputFormat.Visible = False ucrBase.clsRsyntax.RemoveParameter("format") - ucrBase.clsRsyntax.RemoveParameter("origin") - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yeardoy") - grpTwoColumns.Visible = True - grpThreeColumns.Visible = False - grpSingleColumn.Visible = False - If ucrReceiverYearTwo.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearTwo.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("year") - End If - If ucrReceiverDayTwo.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("doy", ucrReceiverDayTwo.GetVariableNames()) + ElseIf rdoSpecifyFormat.Checked Then + ucrBase.clsRsyntax.RemoveParameter("origin") + ucrInputFormat.Visible = True + If Not ucrInputFormat.IsEmpty Then + ucrBase.clsRsyntax.AddParameter("format", Chr(34) & ucrInputFormat.GetText & Chr(34)) Else - ucrBase.clsRsyntax.RemoveParameter("doy") + ucrBase.clsRsyntax.RemoveParameter("format") End If - ucrBase.clsRsyntax.RemoveParameter("month") - ucrBase.clsRsyntax.RemoveParameter("day") Else - ucrReceiverYearThree.SetMeAsReceiver() - ucrBase.clsRsyntax.AddParameter("data_name", Chr(34) & ucrSeclectorMakeDate.ucrAvailableDataFrames.cboAvailableDataFrames.SelectedItem & Chr(34)) - ucrBase.clsRsyntax.RemoveParameter("doy") - ucrBase.clsRsyntax.RemoveParameter("year") - ucrBase.clsRsyntax.SetFunction(frmMain.clsRLink.strInstatDataObject & "$make_date_yearmonthday") - If Not ucrReceiverYearThree.IsEmpty Then - ucrBase.clsRsyntax.AddParameter("year", ucrReceiverYearThree.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("year") - End If - If ucrReceiverMonthThree.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("month", ucrReceiverMonthThree.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("month") - End If - If ucrReceiverDayThree.IsEmpty = False Then - ucrBase.clsRsyntax.AddParameter("day", ucrReceiverDayThree.GetVariableNames()) - Else - ucrBase.clsRsyntax.RemoveParameter("day") - End If - grpThreeColumns.Visible = True - grpTwoColumns.Visible = False - grpSingleColumn.Visible = False - ucrBase.clsRsyntax.RemoveParameter("x") + ucrInputFormat.Visible = False ucrBase.clsRsyntax.RemoveParameter("format") ucrBase.clsRsyntax.RemoveParameter("origin") End If End Sub +End Class + + + + -End Class \ No newline at end of file From 4f5f649a52efed97b7ea37c7b3c31fa8c4a53b51 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Tue, 11 Oct 2016 16:31:10 +0300 Subject: [PATCH 22/37] Minor changes on the calculator --- instat/dlgCalculator.designer.vb | 24 ++++++++++++++++++++++++ instat/dlgCalculator.vb | 22 +++++++++++----------- instat/ucrButtons.vb | 2 -- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/instat/dlgCalculator.designer.vb b/instat/dlgCalculator.designer.vb index 766e1174c50..ea77d17ddec 100644 --- a/instat/dlgCalculator.designer.vb +++ b/instat/dlgCalculator.designer.vb @@ -150,6 +150,8 @@ Partial Class dlgCalculator Me.ucrSaveResultInto = New instat.ucrInputComboBox() Me.ucrInputTryMessage = New instat.ucrInputTextBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() + Me.cmdHelp = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() Me.grpBasic.SuspendLayout() Me.grpDates.SuspendLayout() Me.grpMaths.SuspendLayout() @@ -1601,11 +1603,31 @@ Partial Class dlgCalculator Me.ucrSelectorForCalculations.Size = New System.Drawing.Size(210, 181) Me.ucrSelectorForCalculations.TabIndex = 106 ' + 'cmdHelp + ' + Me.cmdHelp.Location = New System.Drawing.Point(387, 217) + Me.cmdHelp.Name = "cmdHelp" + Me.cmdHelp.Size = New System.Drawing.Size(75, 23) + Me.cmdHelp.TabIndex = 172 + Me.cmdHelp.Text = "Help" + Me.cmdHelp.UseVisualStyleBackColor = True + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(567, 237) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(8, 8) + Me.Button2.TabIndex = 173 + Me.Button2.Text = "Button2" + Me.Button2.UseVisualStyleBackColor = True + ' 'dlgCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(832, 340) + Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpProbabilty) Me.Controls.Add(Me.chkShowArguments) @@ -1770,4 +1792,6 @@ Partial Class dlgCalculator Friend WithEvents cmdClossingBracket As Button Friend WithEvents cmdQuotes As Button Friend WithEvents cmdSquareBrackets As Button + Friend WithEvents cmdHelp As Button + Friend WithEvents Button2 As Button End Class diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index 9e66783aeb0..8422c13e393 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -22,16 +22,16 @@ Public Class dlgCalculator Dim clsAttach As New RFunction Dim clsDetach As New RFunction Public bFirstLoad As Boolean = True - Public bHelpClicked As Boolean = False + + Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) - ucrBase.iHelpTopicID = 14 If bFirstLoad Then InitialiseDialog() SetDefaults() bFirstLoad = False - Else + Else ReopenDialog() End If TestOKEnabled() @@ -70,6 +70,7 @@ Public Class dlgCalculator End Sub Private Sub InitialiseDialog() + ucrBase.iHelpTopicID = 14 ucrReceiverForCalculation.Selector = ucrSelectorForCalculations ucrReceiverForCalculation.SetMeAsReceiver() clsAttach.SetRCommand("attach") @@ -84,6 +85,7 @@ Public Class dlgCalculator ucrSelectorForCalculations.Reset() ucrInputCalOptions.SetItems({"Basic", "Maths", "Logical and Symbols", "Summary", "Text", "Runoff", "Dates"}) ucrSaveResultInto.SetValidationTypeAsRVariable() + End Sub Private Sub cmd0_Click(sender As Object, e As EventArgs) Handles cmd0.Click @@ -214,11 +216,6 @@ Public Class dlgCalculator Private Sub ucrInputCalOptions_NameChanged() Handles ucrInputCalOptions.NameChanged CalculationsOptions() - - If ucrBase.bHelpCLicked Then - ucrBase.HelpContent() - End If - End Sub Private Sub CalculationsOptions() @@ -242,6 +239,8 @@ Public Class dlgCalculator Me.Size = New System.Drawing.Size(580, 377) grpProbabilty.Visible = False ucrBase.iHelpTopicID = 127 + + Case "Summary" grpDates.Visible = False grpStatistics.Visible = True @@ -291,9 +290,9 @@ Public Class dlgCalculator grpLogical.Visible = False grpMaths.Visible = False grpStrings.Visible = False - ucrBase.iHelpTopicID = 14 End Select End Sub + Private Sub cmdPi_Click(sender As Object, e As EventArgs) Handles cmdPi.Click ucrReceiverForCalculation.AddToReceiverAtCursorPosition("pi") End Sub @@ -974,7 +973,8 @@ Public Class dlgCalculator TryScript() End Sub - Private Sub ucrBase_HelpRequested(sender As Object, hlpevent As HelpEventArgs) Handles ucrBase.HelpRequested - bHelpClicked = True + Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click + CalculationsOptions() + ucrBase.HelpContent() End Sub End Class \ No newline at end of file diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index b072495488e..a732b14da79 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -21,7 +21,6 @@ Public Class ucrButtons Public iHelpTopicID As Integer Public bFirstLoad As Boolean Public strComment As String - Public bHelpCLicked As Boolean = False Public Sub New() ' This call is required by the designer. @@ -131,7 +130,6 @@ Public Class ucrButtons End Sub Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click - bHelpCLicked = True HelpContent() End Sub From d00bc781979b9ba411586ce7c9c84ae42be74a0a Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Tue, 11 Oct 2016 16:51:24 +0300 Subject: [PATCH 23/37] specify origin --- instat/dlgMakeDate.vb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index 16d78b15f41..11b04a58888 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -81,10 +81,10 @@ Public Class dlgMakeDate End Sub Private Sub DateFormat() Select Case ucrInputOrigin.GetText - Case "30-12-1899 (Excel)" - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30(Excel)" & Chr(34)) + Case "30-12-1899" + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30)" & Chr(34)) Case Else - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03 (Gregorian)" & Chr(34)) + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03)" & Chr(34)) End Select End Sub From 368ef8f1422621ead36b981a51557c87bee4068f Mon Sep 17 00:00:00 2001 From: Lily Date: Tue, 11 Oct 2016 16:38:22 +0100 Subject: [PATCH 24/37] This is complete for now. I need to talk to Roger tomorrow before any new amendments. --- instat/dlgOneVarCompareModels.vb | 3 +- instat/dlgOneVarFitModel.vb | 10 +-- instat/dlgOneVarUseModel.Designer.vb | 46 ++++++------ instat/dlgOneVarUseModel.vb | 58 +++++++-------- instat/sdgOneVarCompareModels.vb | 52 ++++++-------- instat/sdgOneVarFitModDisplay.Designer.vb | 18 ++--- instat/sdgOneVarFitModDisplay.vb | 86 +++++++++++++---------- instat/sdgOneVarFitModel.vb | 1 - instat/sdgOneVarUseModFit.vb | 10 +-- 9 files changed, 140 insertions(+), 144 deletions(-) diff --git a/instat/dlgOneVarCompareModels.vb b/instat/dlgOneVarCompareModels.vb index eba694a2142..43addcfb0fe 100644 --- a/instat/dlgOneVarCompareModels.vb +++ b/instat/dlgOneVarCompareModels.vb @@ -41,6 +41,7 @@ Public Class dlgOneVarCompareModels sdgOneVarCompareModels.SetModelFunction(ucrBase.clsRsyntax.clsBaseFunction) sdgOneVarCompareModels.SetReceiver(UcrReceiver) sdgOneVarCompareModels.DisplayChiSquare() + sdgOneVarCompareModels.DisplayChiBreaks() End Sub Private Sub SetDefaults() @@ -91,8 +92,6 @@ Public Class dlgOneVarCompareModels TestOKEnabled() End Sub - - Private Sub EnableOptions() If Not UcrReceiver.IsEmpty Then cmdDisplayObjects.Enabled = True diff --git a/instat/dlgOneVarFitModel.vb b/instat/dlgOneVarFitModel.vb index 5218fe28225..ecff96ec89b 100644 --- a/instat/dlgOneVarFitModel.vb +++ b/instat/dlgOneVarFitModel.vb @@ -48,7 +48,6 @@ Public Class dlgOneVarFitModel sdgOneVarFitModel.SetMyRSyntax(UcrBase.clsRsyntax) sdgOneVarFitModDisplay.SetDistribution(UcrDistributions) sdgOneVarFitModel.SetDistribution(UcrDistributions) - sdgOneVarFitModDisplay.AssignSaveLikelihood() End Sub Private Sub SetDefaults() @@ -68,7 +67,7 @@ Public Class dlgOneVarFitModel End Sub Private Sub TestOKEnabled() - If (chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty() OrElse Not chkSaveModel.Checked) AndAlso Not UcrReceiver.IsEmpty Then + If (chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty() OrElse Not chkSaveModel.Checked) AndAlso Not UcrReceiver.IsEmpty AndAlso sdgOneVarFitModDisplay.TestOkEnabled() Then UcrBase.OKEnabled(True) Else UcrBase.OKEnabled(False) @@ -83,13 +82,11 @@ Public Class dlgOneVarFitModel AssignSaveModel() End Sub - Private Sub ucrSaveModel_NameChanged() Handles ucrSaveModel.NameChanged AssignSaveModel() TestOKEnabled() End Sub - Public Sub SetDataParameter() If Not UcrReceiver.IsEmpty Then If UcrReceiver.strCurrDataType = "numeric" OrElse UcrReceiver.strCurrDataType = "integer" Then @@ -151,6 +148,7 @@ Public Class dlgOneVarFitModel Private Sub cmdDisplayOptions_Click(sender As Object, e As EventArgs) Handles cmdDisplayOptions.Click sdgOneVarFitModDisplay.ShowDialog() EnableOptions() + TestOKEnabled() End Sub Private Sub EnableOptions() @@ -170,7 +168,9 @@ Public Class dlgOneVarFitModel Private Sub UcrBase_ClickOk(sender As Object, e As EventArgs) Handles UcrBase.ClickOk sdgOneVarFitModDisplay.CreateGraphs() - sdgOneVarFitModDisplay.LikelihoodGraphs() + If sdgOneVarFitModel.rdoMle.Checked AndAlso (sdgOneVarFitModDisplay.rdoLoglik.Checked Or sdgOneVarFitModDisplay.rdoLik.Checked) Then + sdgOneVarFitModDisplay.RunLikelihoods() + End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgOneVarUseModel.Designer.vb b/instat/dlgOneVarUseModel.Designer.vb index 1ba6ffae47f..bdc379f2e40 100644 --- a/instat/dlgOneVarUseModel.Designer.vb +++ b/instat/dlgOneVarUseModel.Designer.vb @@ -27,9 +27,9 @@ Partial Class dlgOneVarUseModel Me.cmdBootstrapOptions = New System.Windows.Forms.Button() Me.chkSaveBootstrap = New System.Windows.Forms.CheckBox() Me.chkProduceBootstrap = New System.Windows.Forms.CheckBox() - Me.chkSaveModel = New System.Windows.Forms.CheckBox() + Me.chkSaveDataFrame = New System.Windows.Forms.CheckBox() Me.ucrSaveObjects = New instat.ucrInputComboBox() - Me.ucrSaveModel = New instat.ucrInputComboBox() + Me.ucrNewDataframeName = New instat.ucrInputComboBox() Me.ucrBase = New instat.ucrButtons() Me.ucrReceiver = New instat.ucrReceiverSingle() Me.ucrSelector = New instat.ucrSelectorByDataFrameAddRemove() @@ -46,7 +46,7 @@ Partial Class dlgOneVarUseModel ' 'cmdFitModel ' - Me.cmdFitModel.Location = New System.Drawing.Point(239, 200) + Me.cmdFitModel.Location = New System.Drawing.Point(275, 201) Me.cmdFitModel.Name = "cmdFitModel" Me.cmdFitModel.Size = New System.Drawing.Size(101, 23) Me.cmdFitModel.TabIndex = 13 @@ -55,7 +55,7 @@ Partial Class dlgOneVarUseModel ' 'cmdBootstrapOptions ' - Me.cmdBootstrapOptions.Location = New System.Drawing.Point(239, 167) + Me.cmdBootstrapOptions.Location = New System.Drawing.Point(275, 167) Me.cmdBootstrapOptions.Name = "cmdBootstrapOptions" Me.cmdBootstrapOptions.Size = New System.Drawing.Size(101, 23) Me.cmdBootstrapOptions.TabIndex = 12 @@ -82,15 +82,15 @@ Partial Class dlgOneVarUseModel Me.chkProduceBootstrap.Text = "Produce Bootstrap" Me.chkProduceBootstrap.UseVisualStyleBackColor = True ' - 'chkSaveModel + 'chkSaveDataFrame ' - Me.chkSaveModel.AutoSize = True - Me.chkSaveModel.Location = New System.Drawing.Point(10, 204) - Me.chkSaveModel.Name = "chkSaveModel" - Me.chkSaveModel.Size = New System.Drawing.Size(86, 17) - Me.chkSaveModel.TabIndex = 21 - Me.chkSaveModel.Text = "Save Model:" - Me.chkSaveModel.UseVisualStyleBackColor = True + Me.chkSaveDataFrame.AutoSize = True + Me.chkSaveDataFrame.Location = New System.Drawing.Point(10, 204) + Me.chkSaveDataFrame.Name = "chkSaveDataFrame" + Me.chkSaveDataFrame.Size = New System.Drawing.Size(115, 17) + Me.chkSaveDataFrame.TabIndex = 21 + Me.chkSaveDataFrame.Text = "Save to Dataframe" + Me.chkSaveDataFrame.UseVisualStyleBackColor = True ' 'ucrSaveObjects ' @@ -100,13 +100,13 @@ Partial Class dlgOneVarUseModel Me.ucrSaveObjects.Size = New System.Drawing.Size(137, 21) Me.ucrSaveObjects.TabIndex = 22 ' - 'ucrSaveModel + 'ucrNewDataframeName ' - Me.ucrSaveModel.IsReadOnly = False - Me.ucrSaveModel.Location = New System.Drawing.Point(92, 202) - Me.ucrSaveModel.Name = "ucrSaveModel" - Me.ucrSaveModel.Size = New System.Drawing.Size(137, 21) - Me.ucrSaveModel.TabIndex = 20 + Me.ucrNewDataframeName.IsReadOnly = False + Me.ucrNewDataframeName.Location = New System.Drawing.Point(128, 202) + Me.ucrNewDataframeName.Name = "ucrNewDataframeName" + Me.ucrNewDataframeName.Size = New System.Drawing.Size(138, 21) + Me.ucrNewDataframeName.TabIndex = 20 ' 'ucrBase ' @@ -138,9 +138,9 @@ Partial Class dlgOneVarUseModel ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(425, 302) + Me.ClientSize = New System.Drawing.Size(423, 291) Me.Controls.Add(Me.ucrSaveObjects) - Me.Controls.Add(Me.ucrSaveModel) + Me.Controls.Add(Me.ucrNewDataframeName) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.lblReceiver) Me.Controls.Add(Me.ucrReceiver) @@ -149,7 +149,7 @@ Partial Class dlgOneVarUseModel Me.Controls.Add(Me.cmdBootstrapOptions) Me.Controls.Add(Me.chkSaveBootstrap) Me.Controls.Add(Me.chkProduceBootstrap) - Me.Controls.Add(Me.chkSaveModel) + Me.Controls.Add(Me.chkSaveDataFrame) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -168,7 +168,7 @@ Partial Class dlgOneVarUseModel Friend WithEvents cmdBootstrapOptions As Button Friend WithEvents chkSaveBootstrap As CheckBox Friend WithEvents chkProduceBootstrap As CheckBox - Friend WithEvents chkSaveModel As CheckBox - Friend WithEvents ucrSaveModel As ucrInputComboBox + Friend WithEvents chkSaveDataFrame As CheckBox + Friend WithEvents ucrNewDataframeName As ucrInputComboBox Friend WithEvents ucrSaveObjects As ucrInputComboBox End Class diff --git a/instat/dlgOneVarUseModel.vb b/instat/dlgOneVarUseModel.vb index 812c2482e4b..c98e238546f 100644 --- a/instat/dlgOneVarUseModel.vb +++ b/instat/dlgOneVarUseModel.vb @@ -38,12 +38,12 @@ Public Class dlgOneVarUseModel ucrBase.clsRsyntax.iCallType = 2 ucrReceiver.Selector = ucrSelector ucrReceiver.SetMeAsReceiver() - ucrSaveModel.SetDataFrameSelector(ucrSelector.ucrAvailableDataFrames) - ucrSaveModel.SetPrefix("model") + ucrNewDataframeName.SetDataFrameSelector(ucrSelector.ucrAvailableDataFrames) + ucrNewDataframeName.SetPrefix("UseModel") ucrBase.clsRsyntax.SetFunction("quantile") - ucrSaveModel.SetItemsTypeAsModels() - ucrSaveModel.SetDefaultTypeAsModel() - ucrSaveModel.SetValidationTypeAsRVariable() + ucrNewDataframeName.SetItemsTypeAsModels() + ucrNewDataframeName.SetDefaultTypeAsModel() + ucrNewDataframeName.SetValidationTypeAsRVariable() ucrSaveObjects.SetName("bootstrap") ucrSaveObjects.SetItemsTypeAsModels() ucrSaveObjects.SetDefaultTypeAsModel() @@ -62,10 +62,10 @@ Public Class dlgOneVarUseModel ucrSelector.Focus() sdgOneVarUseModBootstrap.SetDefaults() sdgOneVarUseModFit.SetDefaults() - chkSaveModel.Checked = True + chkSaveDataFrame.Checked = True ucrSaveObjects.Visible = False ucrSaveObjects.Reset() - ucrSaveModel.Reset() + ucrNewDataframeName.Reset() chkProduceBootstrap.Enabled = False chkProduceBootstrap.Checked = False chkSaveBootstrap.Visible = False @@ -81,7 +81,7 @@ Public Class dlgOneVarUseModel End Sub Private Sub TestOKEnabled() - If (chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty() OrElse Not chkSaveModel.Checked) AndAlso Not ucrReceiver.IsEmpty AndAlso (chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty() OrElse Not chkSaveBootstrap.Checked) Then + If Not ucrReceiver.IsEmpty AndAlso (chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty() OrElse Not chkSaveBootstrap.Checked) Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -93,17 +93,17 @@ Public Class dlgOneVarUseModel End Sub Private Sub ucrSelector_DataFrameChanged() Handles ucrSelector.DataFrameChanged - AssignSaveModel() + ' AssignSaveModel() ' AssignSaveObjects() End Sub - Private Sub ucrSaveModel_NameChanged() Handles ucrSaveModel.NameChanged - AssignSaveModel() - TestOKEnabled() - End Sub + ' Private Sub ucrSaveModel_NameChanged() Handles ucrSaveModel.NameChanged + ' AssignSaveModel() + ' TestOKEnabled() + ' End Sub Private Sub ucrSaveObjects_NameChanged() Handles ucrSaveObjects.NameChanged - ' AssignSaveObjects() + 'AssignSaveObjects() TestOKEnabled() End Sub @@ -118,32 +118,22 @@ Public Class dlgOneVarUseModel End Sub - Private Sub AssignSaveModel() - If chkSaveModel.Checked AndAlso Not ucrSaveModel.IsEmpty Then - ucrBase.clsRsyntax.SetAssignTo(ucrSaveModel.GetText, strTempModel:=ucrSaveModel.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + Private Sub AssignSavetoDataFrame() + If chkSaveDataFrame.Checked AndAlso Not ucrNewDataframeName.IsEmpty Then + ucrBase.clsRsyntax.SetAssignTo(ucrNewDataframeName.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) Else ucrBase.clsRsyntax.SetAssignTo("last_model", strTempModel:="last_model", strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) End If End Sub - ' Private Sub AssignSaveObjects() - 'If chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty Then - ' ucrBase.clsRsyntax.SetAssignTo(ucrSaveObjects.GetText, strTempModel:=ucrSaveObjects.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - 'Else - ' ucrBase.clsRsyntax.SetAssignTo("last_bootstrap", strTempModel:="last_bootstrap", strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ' Private Sub AssignSaveObjects() + ' If chkSaveBootstrap.Checked AndAlso Not ucrSaveObjects.IsEmpty Then + '' ucrBase.clsRsyntax.SetAssignTo(ucrSaveObjects.GetText, strTempModel:=ucrSaveObjects.GetText, strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) + ''Else + '' ucrBase.clsRsyntax.SetAssignTo("last_bootstrap", strTempModel:="last_bootstrap", strTempDataframe:=ucrSelector.ucrAvailableDataFrames.cboAvailableDataFrames.Text) 'End If 'End Sub - Private Sub chkSaveModel_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveModel.CheckedChanged - If chkSaveModel.Checked Then - ucrSaveModel.Enabled = True - Else - ucrSaveModel.Enabled = False - End If - AssignSaveModel() - TestOKEnabled() - End Sub - Private Sub chkSaveBootstrap_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveBootstrap.CheckedChanged If Not chkSaveBootstrap.Checked Then ucrSaveObjects.Visible = False @@ -197,7 +187,9 @@ Public Class dlgOneVarUseModel End Sub Private Sub ucrBase_BeforeClickOk(sender As Object, e As EventArgs) Handles ucrBase.BeforeClickOk - frmMain.clsRLink.RunScript(clsRbootFunction.ToScript(), bReturnOutput:=2) + If chkProduceBootstrap.Checked Then + frmMain.clsRLink.RunScript(clsRbootFunction.ToScript(), bReturnOutput:=2) + End If End Sub End Class \ No newline at end of file diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index 3cf0ebb20d5..3a159d066e1 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -17,7 +17,7 @@ Imports instat.Translations Public Class sdgOneVarCompareModels Private clsRcdfcompFunction, clsRdenscompFunction, clsRqqcompFunction, clsRppcompFunction, clsListFunction, clsRAsDataFrame, clsModel, clsRsyntax, clsOperation As New RFunction - Private clsGetObjectOperator As New ROperator + Private clsOperatorforTable, clsOperatorForBreaks As New ROperator Private WithEvents ucrRecs As ucrReceiver Public bfirstload As Boolean = True @@ -26,14 +26,11 @@ Public Class sdgOneVarCompareModels End Sub Public Sub InitialiseDialog() - clsRsyntax.AddParameter("chisqbreaks") clsRcdfcompFunction.SetRCommand("cdfcomp") clsRdenscompFunction.SetRCommand("denscomp") clsRqqcompFunction.SetRCommand("qqcomp") clsRppcompFunction.SetRCommand("ppcomp") ucrDisplayChiData.SetValidationTypeAsRVariable() - ' set default name - ' if not checked, then this doesn't show End Sub Public Sub SetDefaults() @@ -43,7 +40,6 @@ Public Class sdgOneVarCompareModels chkQQ.Checked = False chkSaveChi.Checked = True chkSaveObjects.Checked = True - chkInputBreakpoints.Enabled = False ' disabled for now ucrSavePlots.chkSaveGraph.Checked = False ucrSavePlots.Enabled = False ' disabled for now ucrSavePlots.ucrInputGraphName.SetPrefix("plots") @@ -51,8 +47,8 @@ Public Class sdgOneVarCompareModels ucrObjectName.SetName("gof") ucrDisplayChiData.Reset() ucrDisplayChiData.SetName(dlgOneVarCompareModels.ucrSelectorOneVarCompModels.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_ChiSquare") - ReturnEnabled() DisplayChiSquare() + DisplayChiBreaks() 'ucrBase.ihelptopicID = End Sub @@ -62,21 +58,16 @@ Public Class sdgOneVarCompareModels Public Sub SetModelFunction(clsNewModel As RFunction) clsModel = clsNewModel - clsRcdfcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) - ' clSr.... :=clsModel - clsRdenscompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) - clsRppcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) - clsRqqcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) End Sub Public Sub DisplayChiSquare() If chkSaveChi.Checked Then ucrDisplayChiData.Visible = True - clsGetObjectOperator.SetOperation("$") - clsGetObjectOperator.SetParameter(True, clsRFunc:=clsModel) - clsGetObjectOperator.SetParameter(False, strValue:="chisqtable") + clsOperatorforTable.SetOperation("$") + clsOperatorforTable.SetParameter(True, clsRFunc:=clsModel) + clsOperatorforTable.SetParameter(False, strValue:="chisqtable") clsRAsDataFrame.SetRCommand("as.data.frame") - clsRAsDataFrame.AddParameter("x", clsROperatorParameter:=clsGetObjectOperator) + clsRAsDataFrame.AddParameter("x", clsROperatorParameter:=clsOperatorforTable) Else ucrDisplayChiData.Visible = False End If @@ -91,10 +82,6 @@ Public Class sdgOneVarCompareModels DisplayChiSquare() End Sub - - - ' if it is selected and not given a default name then what happens - Public Sub SetReceiver(ucrNewReceiver As ucrReceiver) ucrRecs = ucrNewReceiver End Sub @@ -105,7 +92,6 @@ Public Class sdgOneVarCompareModels Else ucrObjectName.Visible = True End If - ReturnEnabled() End Sub @@ -113,24 +99,32 @@ Public Class sdgOneVarCompareModels Dim strTemp As String = "" If chkCDF.Checked Then + clsRcdfcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) frmMain.clsRLink.RunScript(clsRcdfcompFunction.ToScript(), 2) End If If chkPP.Checked Then + clsRppcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) frmMain.clsRLink.RunScript(clsRppcompFunction.ToScript(), 2) End If If chkQQ.Checked Then + clsRqqcompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) frmMain.clsRLink.RunScript(clsRqqcompFunction.ToScript(), 2) End If If chkDensity.Checked Then + clsRdenscompFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarCompareModels.UcrReceiver.GetVariables()) frmMain.clsRLink.RunScript(clsRdenscompFunction.ToScript(), 2) End If If chkSaveChi.Checked Then - frmMain.clsRLink.RunScript(clsGetObjectOperator.ToScript(), 0) + frmMain.clsRLink.RunScript(clsOperatorforTable.ToScript(), 0) clsRAsDataFrame.ToScript(strTemp) frmMain.clsRLink.RunScript(strTemp, 0) End If + If chkInputBreakpoints.Checked Then + frmMain.clsRLink.RunScript(clsOperatorForBreaks.ToScript(), 2) + End If End Sub + ' To say if our models are discrete, we cannot use Density, QQ or PP 'Private Sub SetPlotOptions() 'If Not chosenmodels.bIsContinuous Then @@ -148,16 +142,14 @@ Public Class sdgOneVarCompareModels 'End Sub Private Sub chkInputBreakpoints_Checked_Changed(sender As Object, e As EventArgs) Handles chkInputBreakpoints.CheckedChanged - If chkInputBreakpoints.Checked Then - clsRsyntax.AddParameter("chisqbreaks") 'in the brackets have numbers inputted numbers inputted - End If + DisplayChiBreaks() End Sub - Private Sub ReturnEnabled() - If Not (chkSaveObjects.Checked AndAlso ucrObjectName.IsEmpty) Then - ucrSubBase.cmdReturn.Enabled = True - Else - ucrSubBase.cmdReturn.Enabled = False + Public Sub DisplayChiBreaks() + If chkInputBreakpoints.Checked Then + clsOperatorForBreaks.SetOperation("$") + clsOperatorForBreaks.SetParameter(True, clsRFunc:=clsModel) + clsOperatorForBreaks.SetParameter(False, strValue:="chisqbreaks") End If End Sub @@ -172,7 +164,7 @@ Public Class sdgOneVarCompareModels Public Function TestOkEnabled() As Boolean Dim bOkEnabled As Boolean - If (chkSaveObjects.Checked AndAlso Not ucrObjectName.IsEmpty) AndAlso (chkSaveChi.Checked AndAlso Not ucrDisplayChiData.IsEmpty) Then + If (chkSaveObjects.Checked AndAlso Not ucrObjectName.IsEmpty OrElse Not chkSaveObjects.Checked) AndAlso (chkSaveChi.Checked AndAlso Not ucrDisplayChiData.IsEmpty OrElse Not chkSaveChi.Checked) Then bOkEnabled = True Else bOkEnabled = False diff --git a/instat/sdgOneVarFitModDisplay.Designer.vb b/instat/sdgOneVarFitModDisplay.Designer.vb index c352c41c2b6..9e9b192372e 100644 --- a/instat/sdgOneVarFitModDisplay.Designer.vb +++ b/instat/sdgOneVarFitModDisplay.Designer.vb @@ -24,6 +24,7 @@ Partial Class sdgOneVarFitModDisplay Private Sub InitializeComponent() Me.ucrBase = New instat.ucrButtonsSubdialogue() Me.tbclikelihood = New System.Windows.Forms.TabPage() + Me.UcrSaveLikelihood = New instat.ucrSaveGraph() Me.rdoNoLik = New System.Windows.Forms.RadioButton() Me.rdoLik = New System.Windows.Forms.RadioButton() Me.rdoLoglik = New System.Windows.Forms.RadioButton() @@ -36,7 +37,6 @@ Partial Class sdgOneVarFitModDisplay Me.rdoPlotAll = New System.Windows.Forms.RadioButton() Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.tbcPlots = New System.Windows.Forms.TabControl() - Me.UcrSaveLikelihood = New instat.ucrSaveGraph() Me.tbclikelihood.SuspendLayout() Me.TabPage1.SuspendLayout() Me.tbcPlots.SuspendLayout() @@ -63,6 +63,13 @@ Partial Class sdgOneVarFitModDisplay Me.tbclikelihood.Text = "Likelihood" Me.tbclikelihood.UseVisualStyleBackColor = True ' + 'UcrSaveLikelihood + ' + Me.UcrSaveLikelihood.Location = New System.Drawing.Point(8, 158) + Me.UcrSaveLikelihood.Name = "UcrSaveLikelihood" + Me.UcrSaveLikelihood.Size = New System.Drawing.Size(265, 20) + Me.UcrSaveLikelihood.TabIndex = 3 + ' 'rdoNoLik ' Me.rdoNoLik.AutoSize = True @@ -108,7 +115,7 @@ Partial Class sdgOneVarFitModDisplay Me.TabPage1.Location = New System.Drawing.Point(4, 22) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage1.Size = New System.Drawing.Size(262, 185) + Me.TabPage1.Size = New System.Drawing.Size(288, 185) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = "Plots" Me.TabPage1.UseVisualStyleBackColor = True @@ -192,13 +199,6 @@ Partial Class sdgOneVarFitModDisplay Me.tbcPlots.Size = New System.Drawing.Size(296, 211) Me.tbcPlots.TabIndex = 0 ' - 'UcrSaveLikelihood - ' - Me.UcrSaveLikelihood.Location = New System.Drawing.Point(8, 159) - Me.UcrSaveLikelihood.Name = "UcrSaveLikelihood" - Me.UcrSaveLikelihood.Size = New System.Drawing.Size(265, 20) - Me.UcrSaveLikelihood.TabIndex = 3 - ' 'sdgOneVarFitModDisplay ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index aa5e79690e1..c90dc852851 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -29,14 +29,11 @@ Public Class sdgOneVarFitModDisplay End Sub Public Sub InitialiseDialog() - ucrSavePlots.ucrInputGraphName.SetItemsTypeAsGraphs() - ucrSavePlots.ucrInputGraphName.SetDefaultTypeAsGraph() - ucrSavePlots.ucrInputGraphName.SetValidationTypeAsRVariable() - ucrSavePlots.ucrInputGraphName.SetPrefix(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_Plot") - ucrSaveLikelihood.ucrInputGraphName.SetItemsTypeAsGraphs() - ucrSaveLikelihood.ucrInputGraphName.SetDefaultTypeAsGraph() - ucrSaveLikelihood.ucrInputGraphName.SetValidationTypeAsRVariable() - ucrSaveLikelihood.ucrInputGraphName.SetPrefix(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_Likelihood") + UcrSaveLikelihood.SetDataFrameSelector(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames) + UcrSaveLikelihood.strPrefix = "Likelihood" + ucrSavePlots.SetDataFrameSelector(dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames) + ucrSavePlots.strPrefix = "Plot" + clsRLogLikFunction.SetRCommand("llplot") End Sub Public Sub SetDefaults() @@ -44,14 +41,13 @@ Public Class sdgOneVarFitModDisplay rdoLoglik.Checked = True 'ucrSaveLikelihood.Enabled = False 'ucrBase.ihelptopicID = - ucrSaveLikelihood.Reset() + UcrSaveLikelihood.Reset() ucrSavePlots.Reset() - ucrSavePlots.chkSaveGraph.Checked = False - ucrSaveLikelihood.chkSaveGraph.Checked = False End Sub Public Sub SetModelFunction(clsNewModel As RFunction) clsModel = clsNewModel + clsRLogLikFunction.AddParameter("mlefit", clsRFunctionParameter:=clsModel) End Sub Public Sub SetDistribution(ucrNewDists As ucrDistributions) @@ -109,38 +105,56 @@ Public Class sdgOneVarFitModDisplay ' looking into tab2 - Public Sub EnableLikelihood() - If Not sdgOneVarFitModel.rdoMle.Checked Then - tbclikelihood.Enabled = False - If Not rdoNoLik.Checked Then - rdoNoLik.Checked = True - End If + Public Sub rdoLikelihoods_CheckedChanged(sender As Object, e As EventArgs) Handles rdoLoglik.CheckedChanged, rdoLik.CheckedChanged + If rdoLoglik.Checked Then + clsRLogLikFunction.AddParameter("loglik", strParameterValue:="TRUE") + ElseIf rdoLik.Checked Then + clsRLogLikFunction.AddParameter("loglik", strParameterValue:="FALSE") + End If + End Sub + + Public Sub RunLikelihoods() + frmMain.clsRLink.RunScript(clsRLogLikFunction.ToScript(), 2) + End Sub + + + Private Sub UcrSaveLikelihood_GraphNameChanged() Handles UcrSaveLikelihood.GraphNameChanged, UcrSaveLikelihood.SaveGraphCheckedChanged + If UcrSaveLikelihood.bSaveGraph Then + dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo(UcrSaveLikelihood.strGraphName, strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=UcrSaveLikelihood.strGraphName) Else - rdoLoglik.Checked = True + dlgOneVarFitModel.UcrBase.clsRsyntax.RemoveAssignTo() End If End Sub - Public Sub LikelihoodGraphs() - clsRLogLikFunction.SetRCommand("llplot") - clsRLogLikFunction.AddParameter("mlefit", clsRFunctionParameter:=clsModel) - If rdoLoglik.Checked Then - frmMain.clsRLink.RunScript(clsRLogLikFunction.ToScript(), 2) - ElseIf rdoLik.Checked Then - clsRLogLikFunction.AddParameter("loglik", strParameterValue:="FALSE") - frmMain.clsRLink.RunScript(clsRLogLikFunction.ToScript(), 2) + Private Sub ucrSavePlots_GraphNameChanged() Handles ucrSavePlots.GraphNameChanged, ucrSavePlots.SaveGraphCheckedChanged + If ucrSavePlots.bSaveGraph Then + dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo(ucrSavePlots.strGraphName, strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSavePlots.strGraphName) + Else + dlgOneVarFitModel.UcrBase.clsRsyntax.RemoveAssignTo() End If End Sub - Private Sub ucrSaveLikelihood_GraphNameChanged() - AssignSaveLikelihood() + Private Sub VisibleSaveGraph_CheckedChanged(sender As Object, e As EventArgs) Handles rdoNoPlot.CheckedChanged, rdoNoLik.CheckedChanged + If rdoNoPlot.Checked Then + ucrSavePlots.Visible = False + Else + ucrSavePlots.Visible = True + End If + If rdoNoLik.Checked Then + UcrSaveLikelihood.Visible = False + Else + UcrSaveLikelihood.Visible = True + End If End Sub - Public Sub AssignSaveLikelihood() - ' If ucrSaveLikelihood.chkSaveGraph.Checked AndAlso Not ucrSaveLikelihood.ucrInputGraphName.IsEmpty Then - ' dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo(ucrSaveLikelihood.ucrInputGraphName.GetText, strTempGraph:=ucrSaveLikelihood.ucrInputGraphName.GetText, strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - ' Else - ' dlgOneVarFitModel.UcrBase.clsRsyntax.SetAssignTo("last_graph", strTempGraph:="last_graph", strTempDataframe:=dlgOneVarFitModel.ucrSelectorOneVarFitMod.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - ' End If - 'End Sub - 'need to sort this + Public Function TestOkEnabled() As Boolean + Dim bOkEnabled As Boolean + If (ucrSavePlots.chkSaveGraph.Checked AndAlso Not ucrSavePlots.ucrInputGraphName.IsEmpty OrElse Not ucrSavePlots.chkSaveGraph.Checked) AndAlso (UcrSaveLikelihood.chkSaveGraph.Checked AndAlso Not UcrSaveLikelihood.ucrInputGraphName.IsEmpty OrElse Not UcrSaveLikelihood.chkSaveGraph.Checked) Then + bOkEnabled = True + Else + bOkEnabled = False + End If + Return bOkEnabled + End Function + End Class \ No newline at end of file diff --git a/instat/sdgOneVarFitModel.vb b/instat/sdgOneVarFitModel.vb index c4d71b5c6d3..3c5e1e45f60 100644 --- a/instat/sdgOneVarFitModel.vb +++ b/instat/sdgOneVarFitModel.vb @@ -78,7 +78,6 @@ Public Class sdgOneVarFitModel ElseIf rdoMge.Checked Then clsRSyntax.AddParameter("method", Chr(34) & "mge" & Chr(34)) End If - 'sdgOneVarFitModDisplay.EnableLikelihood() End Sub Public Sub SetDistribution(ucrNewDists As ucrDistributions) diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index dd58d22d748..e533844308a 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -59,23 +59,23 @@ Public Class sdgOneVarUseModFit If rdoPlotAll.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("plot") - clsRplotFunction.AddParameter("x", clsRFunctionParameter:=clsModel) + clsRplotFunction.AddParameter("x", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoPPPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("ppcomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoCDFPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("cdfcomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoQQPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("qqcomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoDensityPlot.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("denscomp") - clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=clsModel) + clsRplotFunction.AddParameter("ft", clsRFunctionParameter:=dlgOneVarUseModel.ucrReceiver.GetVariables()) ElseIf rdoCIcdf.Checked Then clsRplotFunction.ClearParameters() clsRplotFunction.SetRCommand("CIcdfplot") From 8c4537398a79f251c066ffcce88a1fca1b804462 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Wed, 12 Oct 2016 09:32:27 +0300 Subject: [PATCH 25/37] Removing an extra button --- instat/dlgCalculator.designer.vb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/instat/dlgCalculator.designer.vb b/instat/dlgCalculator.designer.vb index ea77d17ddec..3cc50459038 100644 --- a/instat/dlgCalculator.designer.vb +++ b/instat/dlgCalculator.designer.vb @@ -151,7 +151,6 @@ Partial Class dlgCalculator Me.ucrInputTryMessage = New instat.ucrInputTextBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() Me.cmdHelp = New System.Windows.Forms.Button() - Me.Button2 = New System.Windows.Forms.Button() Me.grpBasic.SuspendLayout() Me.grpDates.SuspendLayout() Me.grpMaths.SuspendLayout() @@ -1612,21 +1611,11 @@ Partial Class dlgCalculator Me.cmdHelp.Text = "Help" Me.cmdHelp.UseVisualStyleBackColor = True ' - 'Button2 - ' - Me.Button2.Location = New System.Drawing.Point(567, 237) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(8, 8) - Me.Button2.TabIndex = 173 - Me.Button2.Text = "Button2" - Me.Button2.UseVisualStyleBackColor = True - ' 'dlgCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(832, 340) - Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpProbabilty) @@ -1793,5 +1782,4 @@ Partial Class dlgCalculator Friend WithEvents cmdQuotes As Button Friend WithEvents cmdSquareBrackets As Button Friend WithEvents cmdHelp As Button - Friend WithEvents Button2 As Button End Class From 15481157545453cb51afd5987ae9cb87342072a9 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 12 Oct 2016 09:46:28 +0300 Subject: [PATCH 26/37] FactorDataFrame --- instat/dlgFactorDataFrame.Designer.vb | 16 ++++----- instat/dlgFactorDataFrame.vb | 48 ++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/instat/dlgFactorDataFrame.Designer.vb b/instat/dlgFactorDataFrame.Designer.vb index 930db3ef903..0cd9f7811d6 100644 --- a/instat/dlgFactorDataFrame.Designer.vb +++ b/instat/dlgFactorDataFrame.Designer.vb @@ -26,7 +26,7 @@ Partial Class dlgFactorDataFrame Me.ucrReceiverFactorDataFrame = New instat.ucrReceiverSingle() Me.chkReplaceFactorSheet = New System.Windows.Forms.CheckBox() Me.chkAddCurrentContrast = New System.Windows.Forms.CheckBox() - Me.ucrButtons = New instat.ucrButtons() + Me.ucrBase = New instat.ucrButtons() Me.lblSelectedFactor = New System.Windows.Forms.Label() Me.SuspendLayout() ' @@ -69,12 +69,12 @@ Partial Class dlgFactorDataFrame Me.chkAddCurrentContrast.Text = "Add Current Contrasts" Me.chkAddCurrentContrast.UseVisualStyleBackColor = True ' - 'ucrButtons + 'ucrBase ' - Me.ucrButtons.Location = New System.Drawing.Point(9, 208) - Me.ucrButtons.Name = "ucrButtons" - Me.ucrButtons.Size = New System.Drawing.Size(410, 52) - Me.ucrButtons.TabIndex = 3 + Me.ucrBase.Location = New System.Drawing.Point(9, 208) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(410, 52) + Me.ucrBase.TabIndex = 3 ' 'lblSelectedFactor ' @@ -91,7 +91,7 @@ Partial Class dlgFactorDataFrame Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(421, 268) Me.Controls.Add(Me.lblSelectedFactor) - Me.Controls.Add(Me.ucrButtons) + Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.chkAddCurrentContrast) Me.Controls.Add(Me.chkReplaceFactorSheet) Me.Controls.Add(Me.ucrReceiverFactorDataFrame) @@ -111,6 +111,6 @@ Partial Class dlgFactorDataFrame Friend WithEvents ucrReceiverFactorDataFrame As ucrReceiverSingle Friend WithEvents chkReplaceFactorSheet As CheckBox Friend WithEvents chkAddCurrentContrast As CheckBox - Friend WithEvents ucrButtons As ucrButtons + Friend WithEvents ucrBase As ucrButtons Friend WithEvents lblSelectedFactor As Label End Class diff --git a/instat/dlgFactorDataFrame.vb b/instat/dlgFactorDataFrame.vb index 66e4f4d7681..49f9e4764d3 100644 --- a/instat/dlgFactorDataFrame.vb +++ b/instat/dlgFactorDataFrame.vb @@ -1,3 +1,49 @@ -Public Class dlgFactorDataFrame +' Instat-R +' Copyright (C) 2015 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License k +' along with this program. If not, see . + +Imports instat.Translations +Public Class dlgFactorDataFrame + Public bFirstLoad As Boolean = True + Private Sub ucrSelectorFactorDataFrame_Load(sender As Object, e As EventArgs) Handles ucrSelectorFactorDataFrame.Load + If bFirstLoad Then + InitialiseDialog() + SetDefaults() + bFirstLoad = False + Else + ReopenDialog() + End If + TestOkEnabled() + autoTranslate(Me) + + End Sub + Private Sub InitialiseDialog() + SetDefaults() + End Sub + Private Sub SetDefaults() + chkAddCurrentContrast.Checked = False + chkReplaceFactorSheet.Checked = False + End Sub + Private Sub ReopenDialog() + End Sub + Private Sub TestOkEnabled() + If Not ucrReceiverFactorDataFrame.IsEmpty Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End Sub End Class \ No newline at end of file From 65ccfca558628f6be46295af73532a2015bebce3 Mon Sep 17 00:00:00 2001 From: maxwell fundi Date: Wed, 12 Oct 2016 11:21:43 +0300 Subject: [PATCH 27/37] Editing one variable to pass correct aesthetics for the plots with single variable selected --- instat/dlgOneVariableGraph.vb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index eed5433e29d..894b4542b0f 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -87,11 +87,13 @@ Public Class dlgOneVariableGraph 'TODO Geom should come from the subdialog clsRaesFunction.ClearParameters() clsRgeom_Function.SetRCommand(sdgOneVarGraph.strNumericGeomFunction) - If Not ucrReceiverOneVarGraph.IsEmpty() Then + + If Not ucrReceiverOneVarGraph.IsEmpty() AndAlso (sdgOneVarGraph.ucrInputNumeric.GetText = "Boxplot" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Dot Plot" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Point Plot") Then + clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) clsRaesFunction.AddParameter("y", ucrReceiverOneVarGraph.GetVariableNames(False)) + ElseIf Not ucrReceiverOneVarGraph.IsEmpty() AndAlso (sdgOneVarGraph.ucrInputNumeric.GetText = "Histogram" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Density Plot" OrElse sdgOneVarGraph.ucrInputNumeric.GetText = "Frequency Polygon") Then + clsRaesFunction.AddParameter("x", ucrReceiverOneVarGraph.GetVariableNames(False)) End If - - clsRaesFunction.AddParameter("x", Chr(34) & Chr(34)) Else clsRaesFunction.ClearParameters() 'TODO Geom should come from the subdialog @@ -99,6 +101,16 @@ Public Class dlgOneVariableGraph If Not ucrReceiverOneVarGraph.IsEmpty() Then clsRaesFunction.AddParameter("x", ucrReceiverOneVarGraph.GetVariableNames(False)) End If + If sdgOneVarGraph.ucrInputCategorical.GetText = "Pie Chart" Then + Dim clsTempRFunc As New RFunction + clsRgeom_Function.AddParameter("width", "1") + clsTempRFunc.SetRCommand("coord_polar") + clsTempRFunc.AddParameter("theta", Chr(34) & "y" & Chr(34)) + ucrBase.clsRsyntax.AddOperatorParameter("polar", clsRFunc:=clsTempRFunc) + Else + clsRgeom_Function.RemoveParameterByName("width") + ucrBase.clsRsyntax.RemoveOperatorParameter("polar") + End If End If Else ucrBase.clsRsyntax.SetBaseRFunction(clsBaseFunctionMultipleVariables) From 0cdc12c2f6b45249563f2692a3aa33a840ce3293 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 12 Oct 2016 11:33:29 +0300 Subject: [PATCH 28/37] Deleting the "unknown" file from instat --- dlgFactorDataFrame.vb | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 dlgFactorDataFrame.vb diff --git a/dlgFactorDataFrame.vb b/dlgFactorDataFrame.vb deleted file mode 100644 index dc8783c41c9..00000000000 --- a/dlgFactorDataFrame.vb +++ /dev/null @@ -1,5 +0,0 @@ -Imports Microsoft.VisualBasic - -Public Class Class1 - -End Class From 330dddf42ce0398d1a37e0dcf52a4df6ca191c66 Mon Sep 17 00:00:00 2001 From: Lunalo Date: Wed, 12 Oct 2016 11:47:01 +0300 Subject: [PATCH 29/37] Minor changes on calculator --- instat/dlgCalculator.designer.vb | 32 ++++++++++++++++---------------- instat/dlgCalculator.vb | 24 ++++++++++++++++-------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/instat/dlgCalculator.designer.vb b/instat/dlgCalculator.designer.vb index 3cc50459038..1463a4b93e9 100644 --- a/instat/dlgCalculator.designer.vb +++ b/instat/dlgCalculator.designer.vb @@ -144,13 +144,13 @@ Partial Class dlgCalculator Me.cmdLfact = New System.Windows.Forms.Button() Me.cmdTrigamma = New System.Windows.Forms.Button() Me.cmdBeta = New System.Windows.Forms.Button() - Me.ucrBase = New instat.ucrButtons() + Me.cmdHelp = New System.Windows.Forms.Button() Me.ucrInputCalOptions = New instat.ucrInputComboBox() Me.ucrReceiverForCalculation = New instat.ucrReceiverExpression() Me.ucrSaveResultInto = New instat.ucrInputComboBox() Me.ucrInputTryMessage = New instat.ucrInputTextBox() Me.ucrSelectorForCalculations = New instat.ucrSelectorByDataFrameAddRemove() - Me.cmdHelp = New System.Windows.Forms.Button() + Me.ucrBase = New instat.ucrButtons() Me.grpBasic.SuspendLayout() Me.grpDates.SuspendLayout() Me.grpMaths.SuspendLayout() @@ -1548,13 +1548,14 @@ Partial Class dlgCalculator Me.cmdBeta.Text = "beta" Me.cmdBeta.UseVisualStyleBackColor = True ' - 'ucrBase + 'cmdHelp ' - Me.ucrBase.Location = New System.Drawing.Point(8, 285) - Me.ucrBase.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(404, 51) - Me.ucrBase.TabIndex = 0 + Me.cmdHelp.Location = New System.Drawing.Point(427, 223) + Me.cmdHelp.Name = "cmdHelp" + Me.cmdHelp.Size = New System.Drawing.Size(75, 23) + Me.cmdHelp.TabIndex = 172 + Me.cmdHelp.Text = "Help" + Me.cmdHelp.UseVisualStyleBackColor = True ' 'ucrInputCalOptions ' @@ -1602,20 +1603,19 @@ Partial Class dlgCalculator Me.ucrSelectorForCalculations.Size = New System.Drawing.Size(210, 181) Me.ucrSelectorForCalculations.TabIndex = 106 ' - 'cmdHelp + 'ucrBase ' - Me.cmdHelp.Location = New System.Drawing.Point(387, 217) - Me.cmdHelp.Name = "cmdHelp" - Me.cmdHelp.Size = New System.Drawing.Size(75, 23) - Me.cmdHelp.TabIndex = 172 - Me.cmdHelp.Text = "Help" - Me.cmdHelp.UseVisualStyleBackColor = True + Me.ucrBase.Location = New System.Drawing.Point(8, 285) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) + Me.ucrBase.Name = "ucrBase" + Me.ucrBase.Size = New System.Drawing.Size(404, 51) + Me.ucrBase.TabIndex = 0 ' 'dlgCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(832, 340) + Me.ClientSize = New System.Drawing.Size(420, 340) Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpProbabilty) diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index 8422c13e393..a2465cc994b 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -22,7 +22,7 @@ Public Class dlgCalculator Dim clsAttach As New RFunction Dim clsDetach As New RFunction Public bFirstLoad As Boolean = True - + Public calcHelpId As Integer Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -227,7 +227,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpStrings.Visible = False grpProbabilty.Visible = False - ucrBase.iHelpTopicID = 126 + calcHelpId = 126 Me.Size = New System.Drawing.Size(614, 377) Case "Logical and Symbols" grpDates.Visible = False @@ -238,7 +238,7 @@ Public Class dlgCalculator grpStrings.Visible = False Me.Size = New System.Drawing.Size(580, 377) grpProbabilty.Visible = False - ucrBase.iHelpTopicID = 127 + calcHelpId = 127 Case "Summary" @@ -250,7 +250,7 @@ Public Class dlgCalculator Me.Size = New System.Drawing.Size(552, 377) grpStrings.Visible = False grpProbabilty.Visible = False - ucrBase.iHelpTopicID = 128 + calcHelpId = 128 Case "Text" grpDates.Visible = False grpStrings.Visible = True @@ -260,7 +260,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpProbabilty.Visible = False Me.Size = New System.Drawing.Size(580, 377) - ucrBase.iHelpTopicID = 338 + calcHelpId = 338 Case "Runoff" grpDates.Visible = False grpProbabilty.Visible = True @@ -270,7 +270,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(749, 377) - ucrBase.iHelpTopicID = 120 + calcHelpId = 120 Case "Dates" grpDates.Visible = True grpProbabilty.Visible = False @@ -280,7 +280,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(589, 377) - ucrBase.iHelpTopicID = 130 + calcHelpId = 130 Case Else grpDates.Visible = False Me.Size = New System.Drawing.Size(424, 377) @@ -974,7 +974,15 @@ Public Class dlgCalculator End Sub Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click + HelpContent() CalculationsOptions() - ucrBase.HelpContent() + End Sub + + Private Sub HelpContent() + If calcHelpId > 0 Then + Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, calcHelpId.ToString()) + Else + Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TableOfContents) + End If End Sub End Class \ No newline at end of file From 925c286854766bce8d9f99a88d0f08b8da46fe3f Mon Sep 17 00:00:00 2001 From: Lunalo Date: Wed, 12 Oct 2016 12:00:05 +0300 Subject: [PATCH 30/37] Minor changes on the dialog and ucrButtons --- instat/dlgCalculator.designer.vb | 2 +- instat/dlgCalculator.vb | 19 +++++++++---------- instat/ucrButtons.vb | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/instat/dlgCalculator.designer.vb b/instat/dlgCalculator.designer.vb index 1463a4b93e9..100fd54170f 100644 --- a/instat/dlgCalculator.designer.vb +++ b/instat/dlgCalculator.designer.vb @@ -1615,7 +1615,7 @@ Partial Class dlgCalculator ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(420, 340) + Me.ClientSize = New System.Drawing.Size(417, 340) Me.Controls.Add(Me.cmdHelp) Me.Controls.Add(Me.grpDates) Me.Controls.Add(Me.grpProbabilty) diff --git a/instat/dlgCalculator.vb b/instat/dlgCalculator.vb index a2465cc994b..d7eacc5356e 100644 --- a/instat/dlgCalculator.vb +++ b/instat/dlgCalculator.vb @@ -22,7 +22,7 @@ Public Class dlgCalculator Dim clsAttach As New RFunction Dim clsDetach As New RFunction Public bFirstLoad As Boolean = True - Public calcHelpId As Integer + Public iHelpCalcID As Integer Private Sub dlgCalculator_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -227,7 +227,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpStrings.Visible = False grpProbabilty.Visible = False - calcHelpId = 126 + iHelpCalcID = 126 Me.Size = New System.Drawing.Size(614, 377) Case "Logical and Symbols" grpDates.Visible = False @@ -238,7 +238,7 @@ Public Class dlgCalculator grpStrings.Visible = False Me.Size = New System.Drawing.Size(580, 377) grpProbabilty.Visible = False - calcHelpId = 127 + iHelpCalcID = 127 Case "Summary" @@ -250,7 +250,7 @@ Public Class dlgCalculator Me.Size = New System.Drawing.Size(552, 377) grpStrings.Visible = False grpProbabilty.Visible = False - calcHelpId = 128 + iHelpCalcID = 128 Case "Text" grpDates.Visible = False grpStrings.Visible = True @@ -260,7 +260,7 @@ Public Class dlgCalculator grpBasic.Visible = True grpProbabilty.Visible = False Me.Size = New System.Drawing.Size(580, 377) - calcHelpId = 338 + iHelpCalcID = 338 Case "Runoff" grpDates.Visible = False grpProbabilty.Visible = True @@ -270,7 +270,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(749, 377) - calcHelpId = 120 + iHelpCalcID = 120 Case "Dates" grpDates.Visible = True grpProbabilty.Visible = False @@ -280,7 +280,7 @@ Public Class dlgCalculator grpMaths.Visible = False grpBasic.Visible = True Me.Size = New System.Drawing.Size(589, 377) - calcHelpId = 130 + iHelpCalcID = 130 Case Else grpDates.Visible = False Me.Size = New System.Drawing.Size(424, 377) @@ -975,12 +975,11 @@ Public Class dlgCalculator Private Sub cmdHelp_Click(sender As Object, e As EventArgs) Handles cmdHelp.Click HelpContent() - CalculationsOptions() End Sub Private Sub HelpContent() - If calcHelpId > 0 Then - Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, calcHelpId.ToString()) + If iHelpCalcID > 0 Then + Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, iHelpCalcID.ToString()) Else Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TableOfContents) End If diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index a732b14da79..ebdc5e537ea 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -58,8 +58,8 @@ Public Class ucrButtons For Each ctrTempControl In ParentForm.Controls lstCurrentEnabled.Add(ctrTempControl.Enabled) ctrTempControl.Enabled = False - Next - ParentForm.Cursor = Cursors.WaitCursor + Next + ParentForm.Cursor = Cursors.WaitCursor RaiseEvent BeforeClickOk(sender, e) @@ -92,8 +92,8 @@ Public Class ucrButtons For Each ctrTempControl In ParentForm.Controls ctrTempControl.Enabled = lstCurrentEnabled(i) i = i + 1 - Next - ParentForm.Cursor = Cursors.Default + Next + ParentForm.Cursor = Cursors.Default End Sub @@ -133,7 +133,7 @@ Public Class ucrButtons HelpContent() End Sub - Public Sub HelpContent() + Private Sub HelpContent() ' (1) Use HelpNDoc's Help Context number. Not dependent on HelpNDoc. If iHelpTopicID > 0 Then Help.ShowHelp(Me.Parent, frmMain.strStaticPath & "\" & frmMain.strHelpFilePath, HelpNavigator.TopicId, iHelpTopicID.ToString()) From 74fde0feef55629e8dcd9a7596f6e210cb892053 Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 11:56:17 +0100 Subject: [PATCH 31/37] added initial set contrast function in R --- instat/static/InstatObject/R/data_object_R6.R | 8 ++++++++ instat/static/InstatObject/R/instat_object_R6.R | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 9bb72ca16ed..348a3567174 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1608,4 +1608,12 @@ data_object$set("public","make_date_yeardoy", function(year, doy, year_format = #TODO this will be more complex to make into account of doy_typical_length return(as.Date(paste(year_col, doy_col), format = paste(year_format, doy_format))) } +) + +data_object$set("public","set_contrasts_of_factor", function(factor, new_contrasts) { + if(!factor %in% names(self$get_data_frame())) stop(factor, " not found in the data") + if(!is.factor(self$get_columns_from_data(factor))) stop(factor, " is not a factor column.") + #checks needed on contrasts before assigning + contrasts(private$data[[factor]]) <- new_contrasts +} ) \ No newline at end of file diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index eb8edea7f91..680e9104832 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -947,4 +947,9 @@ instat_object$set("public","make_date_yearmonthday", function(data_name, year, m instat_object$set("public","make_date_yeardoy", function(data_name, year, doy, year_format = "%Y", doy_format = "%j", doy_typical_length = "366") { self$get_data_objects(data_name)$make_date_yeardoy(year = year, doy = doy, year_format = year_format, doy_format = doy_format, doy_typical_length = doy_typical_length) } +) + +instat_object$set("public","set_contrasts_of_factor", function(data_name, factor, new_contrasts) { + self$get_data_objects(data_name)$set_contrasts_of_factor(factor = factor, new_contrasts = new_contrasts) +} ) \ No newline at end of file From 4a195a3886508933a7e16dbfb7c7bce7fda1c3f7 Mon Sep 17 00:00:00 2001 From: steven ndung'u Date: Wed, 12 Oct 2016 14:35:09 +0300 Subject: [PATCH 32/37] Make Date and Form main changes --- instat/dlgMakeDate.vb | 40 +++++++++++++++++++--------------------- instat/frmMain.vb | 4 ---- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/instat/dlgMakeDate.vb b/instat/dlgMakeDate.vb index 11b04a58888..15195c9f7c6 100644 --- a/instat/dlgMakeDate.vb +++ b/instat/dlgMakeDate.vb @@ -18,16 +18,16 @@ Imports instat.Translations Public Class dlgMakeDate Public clsPaste As New RFunction Public bFirstLoad As Boolean = True - Private Sub ucrSeclectorMakeDate_Load(sender As Object, e As EventArgs) Handles ucrSeclectorMakeDate.Load + Private Sub dlgMakeDate_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then - InitialiseDialog() + InitialiseDialog() SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - End If - TestOKEnabled() - autoTranslate(Me) + bFirstLoad = False + Else + ReopenDialog() + End If + TestOKEnabled() + autoTranslate(Me) End Sub @@ -46,7 +46,7 @@ Public Class dlgMakeDate ucrInputComboBoxTearThree.SetItems({"4 digits", "2 digits"}) ucrInputOrigin.SetItems({"30-12-1899 (Excel)", "01-03-1600 (Gregorian)"}) - ucrBase.clsRsyntax.SetFunction("as.Date") + ucrBase.clsRsyntax.SetFunction("as.Date") ucrBase.clsRsyntax.AddParameter("x") End Sub @@ -81,14 +81,18 @@ Public Class dlgMakeDate End Sub Private Sub DateFormat() Select Case ucrInputOrigin.GetText - Case "30-12-1899" - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30)" & Chr(34)) + Case "30-12-1899 (Excel)" + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1899-12-30" & Chr(34)) Case Else - ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03)" & Chr(34)) + ucrBase.clsRsyntax.AddParameter("origin", Chr(34) & "1600-01-03" & Chr(34)) End Select End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk + setHistory() + End Sub + + Private Sub setHistory() If Not ucrInputFormat.cboInput.Items.Contains(ucrInputFormat.GetText) Then ucrInputFormat.cboInput.Items.Insert(0, ucrInputFormat.GetText) Else @@ -132,10 +136,6 @@ Public Class dlgMakeDate End If End Sub - Private Sub ucrReceiverForDate_Load(sender As Object, e As EventArgs) - - End Sub - Private Sub rdoSingleColumn_CheckedChanged(sender As Object, e As EventArgs) Handles rdoSingleColumn.CheckedChanged, rdoYearandDayofYear.CheckedChanged, rdoYearMonthDay.CheckedChanged ShowGroups() End Sub @@ -194,11 +194,6 @@ Public Class dlgMakeDate Formats() End Sub - Private Sub ucrSeclectorMakeDate_DataFrameChanged() Handles ucrSeclectorMakeDate.DataFrameChanged - - End Sub - - Private Sub ucrInputOrigin_NameChanged() Handles ucrInputOrigin.NameChanged Formats() If Not ucrInputOrigin.IsEmpty Then @@ -211,10 +206,12 @@ Public Class dlgMakeDate Private Sub Formats() If rdoSpecifyOrigin.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric"}) ucrInputFormat.Visible = False ucrBase.clsRsyntax.RemoveParameter("format") ElseIf rdoSpecifyFormat.Checked Then + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) ucrBase.clsRsyntax.RemoveParameter("origin") ucrInputFormat.Visible = True If Not ucrInputFormat.IsEmpty Then @@ -224,6 +221,7 @@ Public Class dlgMakeDate End If Else ucrInputFormat.Visible = False + ucrReceiverForDate.SetIncludedDataTypes({"numeric", "character", "factor", "integer"}) ucrBase.clsRsyntax.RemoveParameter("format") ucrBase.clsRsyntax.RemoveParameter("origin") End If diff --git a/instat/frmMain.vb b/instat/frmMain.vb index 9d17a1837c1..5e8f50e7f50 100644 --- a/instat/frmMain.vb +++ b/instat/frmMain.vb @@ -1171,8 +1171,4 @@ Public Class frmMain Private Sub mnuOrganiseColumnMakeDate_Click(sender As Object, e As EventArgs) Handles mnuOrganiseColumnMakeDate.Click dlgMakeDate.ShowDialog() End Sub - - Private Sub mnuOrganiseColumnMakeDate_Click_1(sender As Object, e As EventArgs) Handles mnuOrganiseColumnMakeDate.Click - dlgMakeDate.ShowDialog() - End Sub End Class \ No newline at end of file From 50cef4d569839f9e3301f781ef7baa95469ae9f9 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 12 Oct 2016 13:50:01 +0100 Subject: [PATCH 33/37] Added distributions --- instat/My Project/Resources.Designer.vb | 27 ++++++++++++++++++ instat/My Project/Resources.resx | 9 ++++++ instat/ucrDistributions.vb | 38 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/instat/My Project/Resources.Designer.vb b/instat/My Project/Resources.Designer.vb index a871064b018..fca55383eb3 100644 --- a/instat/My Project/Resources.Designer.vb +++ b/instat/My Project/Resources.Designer.vb @@ -290,6 +290,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Beta. + ''' + Friend ReadOnly Property Beta() As String + Get + Return ResourceManager.GetString("Beta", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Binomial. ''' @@ -2298,6 +2307,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Negative Binomial. + ''' + Friend ReadOnly Property Negative_Binomial() As String + Get + Return ResourceManager.GetString("Negative_Binomial", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to New Column Name. ''' @@ -3696,6 +3714,15 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Students t. + ''' + Friend ReadOnly Property Students_t() As String + Get + Return ResourceManager.GetString("Students_t", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Submit. ''' diff --git a/instat/My Project/Resources.resx b/instat/My Project/Resources.resx index fb8934bc2c9..a1c9bad919f 100644 --- a/instat/My Project/Resources.resx +++ b/instat/My Project/Resources.resx @@ -1513,4 +1513,13 @@ Location + + Beta + + + Negative Binomial + + + Students t + \ No newline at end of file diff --git a/instat/ucrDistributions.vb b/instat/ucrDistributions.vb index 22b0179e173..5b8abe4d8a5 100644 --- a/instat/ucrDistributions.vb +++ b/instat/ucrDistributions.vb @@ -188,6 +188,9 @@ Public Class ucrDistributions Dim clsQuasiDist As New Distribution Dim clsQuasibinomialDist As New Distribution Dim clsQuasipoissonDist As New Distribution + Dim clsBetaDist As New Distribution + Dim clsNegBinomDist As New Distribution + Dim clsStudentsTDist As New Distribution ' Normal distribution clsNormalDist.strNameTag = "Normal" @@ -300,6 +303,40 @@ Public Class ucrDistributions clsPoissonDist.AddParameter("lambda", "Mean", 1) lstAllDistributions.Add(clsPoissonDist) + 'Beta Distribution + clsBetaDist.strNameTag = "Beta" + clsBetaDist.strRName = "beta" + clsBetaDist.strRFunctionName = "rbeta" + clsBetaDist.strPFunctionName = "pbeta" + clsBetaDist.strQFunctionName = "qbeta" + clsBetaDist.strDFunctionName = "dbeta" + clsBetaDist.bIsContinuous = True + clsBetaDist.AddParameter("shape1", "a", 1) + clsBetaDist.AddParameter("shape2", "b", 1) + lstAllDistributions.Add(clsBetaDist) + + 'Negative Binomial Distribution + clsNegBinomDist.strNameTag = "Negative_Binomial" + clsNegBinomDist.strRName = "nbinom" + clsNegBinomDist.strRFunctionName = "rnbinom" + clsNegBinomDist.strPFunctionName = "pnbinom" + clsNegBinomDist.strQFunctionName = "qnbinom" + clsNegBinomDist.strDFunctionName = "dnbinom" + clsNegBinomDist.bIsContinuous = False + clsNegBinomDist.AddParameter("size", "Number", 1) + clsNegBinomDist.AddParameter("prob", "Probability", 0.5) + lstAllDistributions.Add(clsNegBinomDist) + + 'T Distribution + ' clsStudentsTDist.strNameTag = "Students_t" + ' clsStudentsTDist.strRName = "t" + ' clsStudentsTDist.strRFunctionName = "rt" + ' clsStudentsTDist.strPFunctionName = "pt" + ' clsStudentsTDist.strQFunctionName = "qt" + ' clsStudentsTDist.strDFunctionName = "dt" + ' clsStudentsTDist.AddParameter("df", "DF", 1) + ' lstAllDistributions.Add(clsStudentsTDist) + ' von mises distribution clsVonnMisesDist.strNameTag = "von_mises" clsVonnMisesDist.strRName = "vonmises" @@ -412,6 +449,7 @@ Public Class ucrDistributions clsQuasipoissonDist.bPositiveInt = True lstAllDistributions.Add(clsQuasipoissonDist) + bDistributionsSet = True End Sub Public Event cboDistributionsIndexChanged(sender As Object, e As EventArgs) From 26f6b2acbdd4502fe084020770bb6184f8385ec1 Mon Sep 17 00:00:00 2001 From: Lily Date: Wed, 12 Oct 2016 15:43:02 +0100 Subject: [PATCH 34/37] A few clean up fixes to One Var Model --- instat/dlgOneVarFitModel.vb | 7 +++++-- instat/dlgOneVarUseModel.vb | 2 +- instat/sdgOneVarCompareModels.vb | 18 ------------------ instat/sdgOneVarFitModDisplay.vb | 1 - instat/sdgOneVarFitModel.vb | 10 ---------- instat/sdgOneVarUseModFit.Designer.vb | 20 +++++++++++++++----- instat/sdgOneVarUseModFit.vb | 10 +++++++--- 7 files changed, 28 insertions(+), 40 deletions(-) diff --git a/instat/dlgOneVarFitModel.vb b/instat/dlgOneVarFitModel.vb index ecff96ec89b..5ab64178769 100644 --- a/instat/dlgOneVarFitModel.vb +++ b/instat/dlgOneVarFitModel.vb @@ -121,9 +121,9 @@ Public Class dlgOneVarFitModel Private Sub chkSaveModel_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveModel.CheckedChanged If chkSaveModel.Checked Then - ucrSaveModel.Enabled = True + ucrSaveModel.Visible = True Else - ucrSaveModel.Enabled = False + ucrSaveModel.Visible = False End If AssignSaveModel() TestOKEnabled() @@ -171,6 +171,9 @@ Public Class dlgOneVarFitModel If sdgOneVarFitModel.rdoMle.Checked AndAlso (sdgOneVarFitModDisplay.rdoLoglik.Checked Or sdgOneVarFitModDisplay.rdoLik.Checked) Then sdgOneVarFitModDisplay.RunLikelihoods() End If + ' If Not sdgOneVarFitModel.rdoMle.Checked AndAlso (sdgOneVarFitModDisplay.rdoLoglik.Checked Or sdgOneVarFitModDisplay.rdoLik.Checked) Then + 'message to say likelihood won't be displayed + ' End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgOneVarUseModel.vb b/instat/dlgOneVarUseModel.vb index c98e238546f..81403ccef4e 100644 --- a/instat/dlgOneVarUseModel.vb +++ b/instat/dlgOneVarUseModel.vb @@ -93,7 +93,7 @@ Public Class dlgOneVarUseModel End Sub Private Sub ucrSelector_DataFrameChanged() Handles ucrSelector.DataFrameChanged - ' AssignSaveModel() + AssignSavetoDataFrame() ' AssignSaveObjects() End Sub diff --git a/instat/sdgOneVarCompareModels.vb b/instat/sdgOneVarCompareModels.vb index 3a159d066e1..c7bb6ce59f0 100644 --- a/instat/sdgOneVarCompareModels.vb +++ b/instat/sdgOneVarCompareModels.vb @@ -124,23 +124,6 @@ Public Class sdgOneVarCompareModels End If End Sub - - ' To say if our models are discrete, we cannot use Density, QQ or PP - 'Private Sub SetPlotOptions() - 'If Not chosenmodels.bIsContinuous Then - ' chkDensity.Enabled = False - ' chkQQ.Enabled = False - ' rdoPPPlot.Enabled = False - 'If chkDensity.Checked = True Or chkQQ.Checked = True Or chkPP.Checked = True Then - ' chkCDF.Checked = True - 'End If - 'Else - ' chkDensity.Enabled = True - ' chkQQ.Enabled = True - ' chkPP.Enabled = True - 'End If - 'End Sub - Private Sub chkInputBreakpoints_Checked_Changed(sender As Object, e As EventArgs) Handles chkInputBreakpoints.CheckedChanged DisplayChiBreaks() End Sub @@ -161,7 +144,6 @@ Public Class sdgOneVarCompareModels 'TODO Graph Names assigned go up in increments for any of the graphs selected (e.g. 3 plots are selected and it is named "plots", then automatically we get "plots1", ... , "plots3" 'End Sub - Public Function TestOkEnabled() As Boolean Dim bOkEnabled As Boolean If (chkSaveObjects.Checked AndAlso Not ucrObjectName.IsEmpty OrElse Not chkSaveObjects.Checked) AndAlso (chkSaveChi.Checked AndAlso Not ucrDisplayChiData.IsEmpty OrElse Not chkSaveChi.Checked) Then diff --git a/instat/sdgOneVarFitModDisplay.vb b/instat/sdgOneVarFitModDisplay.vb index c90dc852851..5de11a7859d 100644 --- a/instat/sdgOneVarFitModDisplay.vb +++ b/instat/sdgOneVarFitModDisplay.vb @@ -17,7 +17,6 @@ Imports instat.Translations Public Class sdgOneVarFitModDisplay Private clsRplotFunction As New RFunction - Private clsSaveLikelihood As New RFunction Private clsModel As New RFunction Private clsRLogLikFunction As New RFunction Private WithEvents ucrDists As ucrDistributions diff --git a/instat/sdgOneVarFitModel.vb b/instat/sdgOneVarFitModel.vb index 3c5e1e45f60..29b0eeca1cd 100644 --- a/instat/sdgOneVarFitModel.vb +++ b/instat/sdgOneVarFitModel.vb @@ -31,17 +31,8 @@ Public Class sdgOneVarFitModel clsRSyntax.AddParameter("method") End Sub - Public Sub SetDefaults() - rdoMle.Enabled = True - rdoMme.Enabled = True rdoQme.Enabled = False - rdoMge.Enabled = True - rdoDefault.Enabled = True - rdoNelderMead.Enabled = True - rdoBFGS.Enabled = True - rdoCG.Enabled = True - rdoSANN.Enabled = True rdoDefault.Checked = True rdoMle.Checked = True 'ucrBase.ihelptopicID = @@ -52,7 +43,6 @@ Public Class sdgOneVarFitModel End Sub Private Sub rdoOptimMethod_CheckedChanged(sender As Object, e As EventArgs) Handles rdoDefault.CheckedChanged, rdoNelderMead.CheckedChanged, rdoBFGS.CheckedChanged, rdoCG.CheckedChanged, rdoSANN.CheckedChanged - If rdoDefault.Checked Then clsRSyntax.AddParameter("optim.method", Chr(34) & "default" & Chr(34)) ElseIf rdoNelderMead.Checked Then diff --git a/instat/sdgOneVarUseModFit.Designer.vb b/instat/sdgOneVarUseModFit.Designer.vb index a45f1785443..4948d7a1dcf 100644 --- a/instat/sdgOneVarUseModFit.Designer.vb +++ b/instat/sdgOneVarUseModFit.Designer.vb @@ -32,6 +32,7 @@ Partial Class sdgOneVarUseModFit Me.rdoPlotAll = New System.Windows.Forms.RadioButton() Me.rdoNoPlot = New System.Windows.Forms.RadioButton() Me.TabPage2 = New System.Windows.Forms.TabPage() + Me.ucrInputValues = New instat.ucrMultipleInput() Me.lblBy = New System.Windows.Forms.Label() Me.lblTo = New System.Windows.Forms.Label() Me.lblFrom = New System.Windows.Forms.Label() @@ -56,7 +57,7 @@ Partial Class sdgOneVarUseModFit Me.tbcQuantiles.Location = New System.Drawing.Point(7, 7) Me.tbcQuantiles.Name = "tbcQuantiles" Me.tbcQuantiles.SelectedIndex = 0 - Me.tbcQuantiles.Size = New System.Drawing.Size(218, 210) + Me.tbcQuantiles.Size = New System.Drawing.Size(218, 209) Me.tbcQuantiles.TabIndex = 2 ' 'tbcPlots @@ -71,7 +72,7 @@ Partial Class sdgOneVarUseModFit Me.tbcPlots.Location = New System.Drawing.Point(4, 22) Me.tbcPlots.Name = "tbcPlots" Me.tbcPlots.Padding = New System.Windows.Forms.Padding(3) - Me.tbcPlots.Size = New System.Drawing.Size(210, 184) + Me.tbcPlots.Size = New System.Drawing.Size(210, 191) Me.tbcPlots.TabIndex = 0 Me.tbcPlots.Text = "Plots" Me.tbcPlots.UseVisualStyleBackColor = True @@ -150,6 +151,7 @@ Partial Class sdgOneVarUseModFit ' 'TabPage2 ' + Me.TabPage2.Controls.Add(Me.ucrInputValues) Me.TabPage2.Controls.Add(Me.lblBy) Me.TabPage2.Controls.Add(Me.lblTo) Me.TabPage2.Controls.Add(Me.lblFrom) @@ -161,11 +163,18 @@ Partial Class sdgOneVarUseModFit Me.TabPage2.Location = New System.Drawing.Point(4, 22) Me.TabPage2.Name = "TabPage2" Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage2.Size = New System.Drawing.Size(210, 184) + Me.TabPage2.Size = New System.Drawing.Size(210, 183) Me.TabPage2.TabIndex = 1 Me.TabPage2.Text = "Quantiles" Me.TabPage2.UseVisualStyleBackColor = True ' + 'ucrInputValues + ' + Me.ucrInputValues.Location = New System.Drawing.Point(5, 152) + Me.ucrInputValues.Name = "ucrInputValues" + Me.ucrInputValues.Size = New System.Drawing.Size(156, 29) + Me.ucrInputValues.TabIndex = 8 + ' 'lblBy ' Me.lblBy.AutoSize = True @@ -243,7 +252,7 @@ Partial Class sdgOneVarUseModFit ' 'ucrBase ' - Me.ucrBase.Location = New System.Drawing.Point(11, 223) + Me.ucrBase.Location = New System.Drawing.Point(44, 218) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(142, 30) Me.ucrBase.TabIndex = 3 @@ -252,7 +261,7 @@ Partial Class sdgOneVarUseModFit ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(229, 259) + Me.ClientSize = New System.Drawing.Size(229, 256) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.tbcQuantiles) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow @@ -291,4 +300,5 @@ Partial Class sdgOneVarUseModFit Friend WithEvents nudBy As NumericUpDown Friend WithEvents nudTo As NumericUpDown Friend WithEvents nudFrom As NumericUpDown + Friend WithEvents ucrInputValues As ucrMultipleInput End Class diff --git a/instat/sdgOneVarUseModFit.vb b/instat/sdgOneVarUseModFit.vb index e533844308a..2f692749381 100644 --- a/instat/sdgOneVarUseModFit.vb +++ b/instat/sdgOneVarUseModFit.vb @@ -43,8 +43,6 @@ Public Class sdgOneVarUseModFit rdoPlotAll.Checked = True rdoSeqValues.Checked = True rdoInsertValues.Enabled = False - 'any of InsertValues needs to be disabled here. - 'ucrBase.ihelptopicID = SetPlotOptions() nudFrom.Value = 0 nudTo.Value = 1 @@ -110,8 +108,14 @@ Public Class sdgOneVarUseModFit Else rdoCIcdf.Enabled = True End If + End Sub - ' if discrete discribution then cannot do PP, QQ, dens + Private Sub rdoInsertValues_CheckedChanged(sender As Object, e As EventArgs) Handles rdoInsertValues.CheckedChanged + If rdoInsertValues.Checked Then + ucrInputValues.Enabled = True + Else + ucrInputValues.Enabled = False + End If End Sub End Class \ No newline at end of file From f82228d4e270c692d1536f3cf6823f743b22a32c Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 18:32:30 +0100 Subject: [PATCH 35/37] initial create factor data frame method in R --- .../static/InstatObject/R/instat_object_R6.R | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index 680e9104832..13236d7d2cf 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -952,4 +952,45 @@ instat_object$set("public","make_date_yeardoy", function(data_name, year, doy, y instat_object$set("public","set_contrasts_of_factor", function(data_name, factor, new_contrasts) { self$get_data_objects(data_name)$set_contrasts_of_factor(factor = factor, new_contrasts = new_contrasts) } +) + +instat_object$set("public","create_factor_data_frame", function(data_name, factor, factor_data_frame_name, include_contrasts = TRUE, replace = FALSE) { + curr_data_obj <- self$get_data_objects(data_name) + if(!factor %in% names(curr_data_obj$get_data_frame())) stop(factor, " not found in the data") + if(!is.factor(curr_data_obj$get_columns_from_data(factor))) stop(factor, " is not a factor column.") + create <- TRUE + if(self$link_exists_from(data_name, factor)) { + message("Factor data frame already exists.") + if(replace) { + message("Current factor data frame will be replaced.") + #TODO replacing not implemented yet + # This line should be removed when implemented + create <- FALSE + } + else create <- FALSE + } + if(create) { + data_frame_list <- list() + if(missing(factor_data_frame_name)) factor_data_frame_name <- paste0(data_name, "_", factor) + factor_data_frame_name <- make.names(factor_data_frame_name) + factor_data_frame_name <- next_default_item(factor_data_frame_name, self$get_data_names(), include_index = FALSE) + + factor_column <- curr_data_obj$get_columns_from_data(factor) + factor_data_frame <- data.frame(levels(factor_column)) + names(factor_data_frame) <- factor + if(include_contrasts) { + factor_data_frame <- cbind(factor_data_frame, contrasts(factor_column)) + } + row.names(factor_data_frame) <- 1:nrow(factor_data_frame) + names(factor_data_frame)[2:ncol(factor_data_frame)] <- paste0("C", 1:(ncol(factor_data_frame)-1)) + data_frame_list[[factor_data_frame_name]] <- factor_data_frame + self$import_data(data_frame_list) + factor_data_obj <- self$get_data_objects(factor_data_frame_name) + factor_data_obj$add_key(factor) + link_calc <- calculation$new(type = "summary", parameters = factor) + link_obj <- link$new(from_data_frame = data_name, type = keyed_link_label, calculation = link_calc) + link_obj$to_data_frame <- factor_data_frame_name + self$add_link(link_obj) + } +} ) \ No newline at end of file From fa7fef9663921eff87c7cecaa7668000caa1940f Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 18:42:55 +0100 Subject: [PATCH 36/37] add link check function --- .../InstatObject/R/Backend_Components/link.R | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/instat/static/InstatObject/R/Backend_Components/link.R b/instat/static/InstatObject/R/Backend_Components/link.R index e8a49ba2670..ca2c2bd6e90 100644 --- a/instat/static/InstatObject/R/Backend_Components/link.R +++ b/instat/static/InstatObject/R/Backend_Components/link.R @@ -71,4 +71,19 @@ instat_object$set("public", "add_link", function(link_object) { instat_object$set("public", "link_exists", function(new_link) { return(any(sapply(private$.links, function(link) link$equals(new_link)))) } +) + +instat_object$set("public", "link_exists_from", function(from_data_frame, factors) { + link_calc <- calculation$new(type = "summary", parameters = factors) + link_obj <- link$new(from_data_frame = from_data_frame, type = keyed_link_label, calculation = link_calc) + exists = FALSE + for(data_obj in self$get_data_objects()) { + link_obj$to_data_frame <- data_obj$get_metadata(data_name_label) + if(self$link_exists(link_obj)) { + exists = TRUE + break + } + } + return(exists) +} ) \ No newline at end of file From e09727e2293ef83414327f566e7e1ad9cd92fee3 Mon Sep 17 00:00:00 2001 From: dannyparsons Date: Wed, 12 Oct 2016 18:56:22 +0100 Subject: [PATCH 37/37] updated link functions --- instat/static/InstatObject/R/Backend_Components/link.R | 6 ++---- .../InstatObject/R/Backend_Components/summary_functions.R | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/instat/static/InstatObject/R/Backend_Components/link.R b/instat/static/InstatObject/R/Backend_Components/link.R index ca2c2bd6e90..ee9347f77d4 100644 --- a/instat/static/InstatObject/R/Backend_Components/link.R +++ b/instat/static/InstatObject/R/Backend_Components/link.R @@ -29,11 +29,9 @@ link$set("public", "equals", function(compare_link) { && self$to_data_frame == compare_link$to_data_frame && self$type == compare_link$type) { if(self$type == keyed_link_label) { - #print(self$calculation$parameters) - #print(compare_link$calculation$parameters) if(setequal(self$calculation$parameters, compare_link$calculation$parameters) && setequal(names(self$calculation$parameters), names(compare_link$calculation$parameters))) { - for(name in names(compare_link$calculation$parameters)) { - if(compare_link$calculation$parameters[[name]] != self$calculation$parameters[[name]]) return(FALSE) + for(factor_col in compare_link$calculation$parameters) { + if(!factor_col %in% self$calculation$parameters) return(FALSE) } return(TRUE) } diff --git a/instat/static/InstatObject/R/Backend_Components/summary_functions.R b/instat/static/InstatObject/R/Backend_Components/summary_functions.R index efd16289397..cbd715dbe36 100644 --- a/instat/static/InstatObject/R/Backend_Components/summary_functions.R +++ b/instat/static/InstatObject/R/Backend_Components/summary_functions.R @@ -33,7 +33,6 @@ data_object$set("public", "merge_data", function(new_data, by = NULL, type = "le instat_object$set("public", "append_summaries_to_data_object", function(out, data_name, columns_to_summarise, summaries, factors = c(), summary_name, calc, calc_name = "") { if(!is.character(data_name)) stop("data_name must be of type character") factors_list <- factors - names(factors_list) <- factors link_calc <- calculation$new(type = "summary", parameters = factors_list) link_obj <- link$new(from_data_frame = data_name, type = keyed_link_label, calculation = link_calc) exists = FALSE