diff --git a/instat/clsGgplotDefaults.vb b/instat/clsGgplotDefaults.vb index 2c04a9b5f56..e272a0398b5 100644 --- a/instat/clsGgplotDefaults.vb +++ b/instat/clsGgplotDefaults.vb @@ -28,6 +28,36 @@ Public Class GgplotDefaults End Get End Property + Public Shared ReadOnly Property clsScaleColorViridisFunction As RFunction + Get + Dim clsTempFunc As New RFunction + + clsTempFunc.SetPackageName("viridis") + clsTempFunc.SetRCommand("scale_colour_viridis") + clsTempFunc.AddParameter("option", Chr(34) & "viridis" & Chr(34), iPosition:=0) + clsTempFunc.AddParameter("alpha", "1", iPosition:=1) + clsTempFunc.AddParameter("begin", "0", iPosition:=2) + clsTempFunc.AddParameter("end", "1", iPosition:=3) + clsTempFunc.AddParameter("direction", "1", iPosition:=4) + Return clsTempFunc + End Get + End Property + + Public Shared ReadOnly Property clsScaleFillViridisFunction As RFunction + Get + Dim clsTempFunc As New RFunction + + clsTempFunc.SetPackageName("viridis") + clsTempFunc.SetRCommand("scale_fill_viridis") + clsTempFunc.AddParameter("option", Chr(34) & "viridis" & Chr(34), iPosition:=0) + clsTempFunc.AddParameter("alpha", "1", iPosition:=1) + clsTempFunc.AddParameter("begin", "0", iPosition:=2) + clsTempFunc.AddParameter("end", "1", iPosition:=3) + clsTempFunc.AddParameter("direction", "1", iPosition:=4) + Return clsTempFunc + End Get + End Property + Public Shared ReadOnly Property clsDefaultThemeParameter As RParameter Get Dim clsTempParam As New RParameter diff --git a/instat/dlgBoxPlot.vb b/instat/dlgBoxPlot.vb index a2b56d06536..44262a02f32 100644 --- a/instat/dlgBoxPlot.vb +++ b/instat/dlgBoxPlot.vb @@ -36,6 +36,8 @@ Public Class dlgBoxplot Private clsCoordPolarFunction As New RFunction Private clsCoordPolarStartOperator As New ROperator Private clsThemeFunction As New RFunction + Private clsScaleFillViridisFunction As New RFunction + Private clsScaleColourViridisFunction As New RFunction Private dctThemeFunctions As Dictionary(Of String, RFunction) Private bResetSubdialog As Boolean = True Private bResetBoxLayerSubdialog As Boolean = True @@ -257,6 +259,9 @@ Public Class dlgBoxplot clsCoordPolarStartOperator = GgplotDefaults.clsCoordPolarStartOperator.Clone() clsXScaleDateFunction = GgplotDefaults.clsXScaleDateFunction.Clone() clsYScaleDateFunction = GgplotDefaults.clsYScaleDateFunction.Clone() + clsScaleFillViridisFunction = GgplotDefaults.clsScaleFillViridisFunction + clsScaleColourViridisFunction = GgplotDefaults.clsScaleColorViridisFunction + dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorBoxPlot.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) @@ -300,7 +305,11 @@ Public Class dlgBoxplot End Sub Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click - sdgPlots.SetRCode(clsBaseOperator, clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsRaesFunction, clsNewXScalecontinuousFunction:=clsXScaleContinuousFunction, clsNewYScalecontinuousFunction:=clsYScaleContinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, ucrNewBaseSelector:=ucrSelectorBoxPlot, strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog) + sdgPlots.SetRCode(clsBaseOperator, clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsRaesFunction, clsNewXScalecontinuousFunction:=clsXScaleContinuousFunction, + clsNewYScalecontinuousFunction:=clsYScaleContinuousFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, + clsNewFacetFunction:=clsRFacetFunction, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, + clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, + ucrNewBaseSelector:=ucrSelectorBoxPlot, strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog) sdgPlots.ShowDialog() bResetSubdialog = False diff --git a/instat/sdgPlots.Designer.vb b/instat/sdgPlots.Designer.vb index 29859d2cc8f..34c74cd3f9a 100644 --- a/instat/sdgPlots.Designer.vb +++ b/instat/sdgPlots.Designer.vb @@ -41,6 +41,7 @@ Partial Class sdgPlots Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(sdgPlots)) Me.tbpPlotsOptions = New System.Windows.Forms.TabControl() Me.tbpFacet = New System.Windows.Forms.TabPage() + Me.ucrChkDrop = New instat.ucrCheck() Me.ucrNudNumberofRows = New instat.ucrNud() Me.ucrChkNoOfRowsOrColumns = New instat.ucrCheck() Me.ucrChkIncludeFacets = New instat.ucrCheck() @@ -107,8 +108,33 @@ Partial Class sdgPlots Me.ucrInputStartingAngle = New instat.ucrInputTextBox() Me.ucrChkSameScale = New instat.ucrCheck() Me.ucrChkHorizontalPlot = New instat.ucrCheck() + Me.tbpColour = New System.Windows.Forms.TabPage() + Me.ucrChkAddColourScale = New instat.ucrCheck() + Me.ucrChkAddFillScale = New instat.ucrCheck() + Me.grpColourScale = New System.Windows.Forms.GroupBox() + Me.ucrNudColourScaleTransparency = New instat.ucrNud() + Me.ucrInputColourScalePalette = New instat.ucrInputComboBox() + Me.ucrNudColourScaleMapEnds = New instat.ucrNud() + Me.ucrNudColourScaleMapBegins = New instat.ucrNud() + Me.ucrChkColourScaleReverseOrder = New instat.ucrCheck() + Me.ucrChkColourScaleDiscrete = New instat.ucrCheck() + Me.lblColourScaleMapEnds = New System.Windows.Forms.Label() + Me.lblColourScaleMapBegins = New System.Windows.Forms.Label() + Me.lblColourScalePalette = New System.Windows.Forms.Label() + Me.lblColourScaleTransparency = New System.Windows.Forms.Label() + Me.UcrChkChangeColourScale = New instat.ucrCheck() + Me.grpFillScale = New System.Windows.Forms.GroupBox() + Me.ucrNudFillScaleTransparency = New instat.ucrNud() + Me.ucrNudFillScaleMapEnds = New instat.ucrNud() + Me.ucrNudFillScaleMapBegins = New instat.ucrNud() + Me.ucrInputFillScaleColour = New instat.ucrInputComboBox() + Me.ucrChkFilLScaleReverseColourOrder = New instat.ucrCheck() + Me.ucrChkFillScaleDiscrete = New instat.ucrCheck() + Me.lblFillScaleMapEnds = New System.Windows.Forms.Label() + Me.lblFillScaleBeginColour = New System.Windows.Forms.Label() + Me.lblFillScaleColourPalettte = New System.Windows.Forms.Label() + Me.lblFillScaleTransparency = New System.Windows.Forms.Label() Me.ucrBaseSubdialog = New instat.ucrButtonsSubdialogue() - Me.ucrChkDrop = New instat.ucrCheck() Me.tbpPlotsOptions.SuspendLayout() Me.tbpFacet.SuspendLayout() Me.tbpLayers.SuspendLayout() @@ -120,6 +146,9 @@ Partial Class sdgPlots Me.grpCommonOptions.SuspendLayout() Me.tbpCoordinates.SuspendLayout() Me.grpPolarCordinates.SuspendLayout() + Me.tbpColour.SuspendLayout() + Me.grpColourScale.SuspendLayout() + Me.grpFillScale.SuspendLayout() Me.SuspendLayout() ' 'tbpPlotsOptions @@ -131,6 +160,7 @@ Partial Class sdgPlots Me.tbpPlotsOptions.Controls.Add(Me.tbpYAxis) Me.tbpPlotsOptions.Controls.Add(Me.tbpTheme) Me.tbpPlotsOptions.Controls.Add(Me.tbpCoordinates) + Me.tbpPlotsOptions.Controls.Add(Me.tbpColour) resources.ApplyResources(Me.tbpPlotsOptions, "tbpPlotsOptions") Me.tbpPlotsOptions.Name = "tbpPlotsOptions" Me.tbpPlotsOptions.SelectedIndex = 0 @@ -159,6 +189,12 @@ Partial Class sdgPlots Me.tbpFacet.Tag = "Facet" Me.tbpFacet.UseVisualStyleBackColor = True ' + 'ucrChkDrop + ' + Me.ucrChkDrop.Checked = False + resources.ApplyResources(Me.ucrChkDrop, "ucrChkDrop") + Me.ucrChkDrop.Name = "ucrChkDrop" + ' 'ucrNudNumberofRows ' Me.ucrNudNumberofRows.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) @@ -644,17 +680,212 @@ Partial Class sdgPlots resources.ApplyResources(Me.ucrChkHorizontalPlot, "ucrChkHorizontalPlot") Me.ucrChkHorizontalPlot.Name = "ucrChkHorizontalPlot" ' + 'tbpColour + ' + Me.tbpColour.Controls.Add(Me.ucrChkAddColourScale) + Me.tbpColour.Controls.Add(Me.ucrChkAddFillScale) + Me.tbpColour.Controls.Add(Me.grpColourScale) + Me.tbpColour.Controls.Add(Me.UcrChkChangeColourScale) + Me.tbpColour.Controls.Add(Me.grpFillScale) + resources.ApplyResources(Me.tbpColour, "tbpColour") + Me.tbpColour.Name = "tbpColour" + Me.tbpColour.UseVisualStyleBackColor = True + ' + 'ucrChkAddColourScale + ' + Me.ucrChkAddColourScale.Checked = False + resources.ApplyResources(Me.ucrChkAddColourScale, "ucrChkAddColourScale") + Me.ucrChkAddColourScale.Name = "ucrChkAddColourScale" + ' + 'ucrChkAddFillScale + ' + Me.ucrChkAddFillScale.Checked = False + resources.ApplyResources(Me.ucrChkAddFillScale, "ucrChkAddFillScale") + Me.ucrChkAddFillScale.Name = "ucrChkAddFillScale" + ' + 'grpColourScale + ' + Me.grpColourScale.Controls.Add(Me.ucrNudColourScaleTransparency) + Me.grpColourScale.Controls.Add(Me.ucrInputColourScalePalette) + Me.grpColourScale.Controls.Add(Me.ucrNudColourScaleMapEnds) + Me.grpColourScale.Controls.Add(Me.ucrNudColourScaleMapBegins) + Me.grpColourScale.Controls.Add(Me.ucrChkColourScaleReverseOrder) + Me.grpColourScale.Controls.Add(Me.ucrChkColourScaleDiscrete) + Me.grpColourScale.Controls.Add(Me.lblColourScaleMapEnds) + Me.grpColourScale.Controls.Add(Me.lblColourScaleMapBegins) + Me.grpColourScale.Controls.Add(Me.lblColourScalePalette) + Me.grpColourScale.Controls.Add(Me.lblColourScaleTransparency) + resources.ApplyResources(Me.grpColourScale, "grpColourScale") + Me.grpColourScale.Name = "grpColourScale" + Me.grpColourScale.TabStop = False + ' + 'ucrNudColourScaleTransparency + ' + Me.ucrNudColourScaleTransparency.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColourScaleTransparency.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudColourScaleTransparency, "ucrNudColourScaleTransparency") + Me.ucrNudColourScaleTransparency.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudColourScaleTransparency.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColourScaleTransparency.Name = "ucrNudColourScaleTransparency" + Me.ucrNudColourScaleTransparency.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputColourScalePalette + ' + Me.ucrInputColourScalePalette.AddQuotesIfUnrecognised = True + Me.ucrInputColourScalePalette.GetSetSelectedIndex = -1 + Me.ucrInputColourScalePalette.IsReadOnly = False + resources.ApplyResources(Me.ucrInputColourScalePalette, "ucrInputColourScalePalette") + Me.ucrInputColourScalePalette.Name = "ucrInputColourScalePalette" + ' + 'ucrNudColourScaleMapEnds + ' + Me.ucrNudColourScaleMapEnds.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColourScaleMapEnds.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudColourScaleMapEnds, "ucrNudColourScaleMapEnds") + Me.ucrNudColourScaleMapEnds.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudColourScaleMapEnds.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColourScaleMapEnds.Name = "ucrNudColourScaleMapEnds" + Me.ucrNudColourScaleMapEnds.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudColourScaleMapBegins + ' + Me.ucrNudColourScaleMapBegins.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColourScaleMapBegins.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudColourScaleMapBegins, "ucrNudColourScaleMapBegins") + Me.ucrNudColourScaleMapBegins.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudColourScaleMapBegins.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudColourScaleMapBegins.Name = "ucrNudColourScaleMapBegins" + Me.ucrNudColourScaleMapBegins.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrChkColourScaleReverseOrder + ' + Me.ucrChkColourScaleReverseOrder.Checked = False + resources.ApplyResources(Me.ucrChkColourScaleReverseOrder, "ucrChkColourScaleReverseOrder") + Me.ucrChkColourScaleReverseOrder.Name = "ucrChkColourScaleReverseOrder" + ' + 'ucrChkColourScaleDiscrete + ' + Me.ucrChkColourScaleDiscrete.Checked = False + resources.ApplyResources(Me.ucrChkColourScaleDiscrete, "ucrChkColourScaleDiscrete") + Me.ucrChkColourScaleDiscrete.Name = "ucrChkColourScaleDiscrete" + ' + 'lblColourScaleMapEnds + ' + resources.ApplyResources(Me.lblColourScaleMapEnds, "lblColourScaleMapEnds") + Me.lblColourScaleMapEnds.Name = "lblColourScaleMapEnds" + ' + 'lblColourScaleMapBegins + ' + resources.ApplyResources(Me.lblColourScaleMapBegins, "lblColourScaleMapBegins") + Me.lblColourScaleMapBegins.Name = "lblColourScaleMapBegins" + ' + 'lblColourScalePalette + ' + resources.ApplyResources(Me.lblColourScalePalette, "lblColourScalePalette") + Me.lblColourScalePalette.Name = "lblColourScalePalette" + ' + 'lblColourScaleTransparency + ' + resources.ApplyResources(Me.lblColourScaleTransparency, "lblColourScaleTransparency") + Me.lblColourScaleTransparency.Name = "lblColourScaleTransparency" + ' + 'UcrChkChangeColourScale + ' + Me.UcrChkChangeColourScale.Checked = False + resources.ApplyResources(Me.UcrChkChangeColourScale, "UcrChkChangeColourScale") + Me.UcrChkChangeColourScale.Name = "UcrChkChangeColourScale" + ' + 'grpFillScale + ' + Me.grpFillScale.Controls.Add(Me.ucrNudFillScaleTransparency) + Me.grpFillScale.Controls.Add(Me.ucrNudFillScaleMapEnds) + Me.grpFillScale.Controls.Add(Me.ucrNudFillScaleMapBegins) + Me.grpFillScale.Controls.Add(Me.ucrInputFillScaleColour) + Me.grpFillScale.Controls.Add(Me.ucrChkFilLScaleReverseColourOrder) + Me.grpFillScale.Controls.Add(Me.ucrChkFillScaleDiscrete) + Me.grpFillScale.Controls.Add(Me.lblFillScaleMapEnds) + Me.grpFillScale.Controls.Add(Me.lblFillScaleBeginColour) + Me.grpFillScale.Controls.Add(Me.lblFillScaleColourPalettte) + Me.grpFillScale.Controls.Add(Me.lblFillScaleTransparency) + resources.ApplyResources(Me.grpFillScale, "grpFillScale") + Me.grpFillScale.Name = "grpFillScale" + Me.grpFillScale.TabStop = False + ' + 'ucrNudFillScaleTransparency + ' + Me.ucrNudFillScaleTransparency.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFillScaleTransparency.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudFillScaleTransparency, "ucrNudFillScaleTransparency") + Me.ucrNudFillScaleTransparency.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudFillScaleTransparency.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFillScaleTransparency.Name = "ucrNudFillScaleTransparency" + Me.ucrNudFillScaleTransparency.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudFillScaleMapEnds + ' + Me.ucrNudFillScaleMapEnds.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFillScaleMapEnds.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudFillScaleMapEnds, "ucrNudFillScaleMapEnds") + Me.ucrNudFillScaleMapEnds.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudFillScaleMapEnds.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFillScaleMapEnds.Name = "ucrNudFillScaleMapEnds" + Me.ucrNudFillScaleMapEnds.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudFillScaleMapBegins + ' + Me.ucrNudFillScaleMapBegins.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFillScaleMapBegins.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + resources.ApplyResources(Me.ucrNudFillScaleMapBegins, "ucrNudFillScaleMapBegins") + Me.ucrNudFillScaleMapBegins.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudFillScaleMapBegins.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudFillScaleMapBegins.Name = "ucrNudFillScaleMapBegins" + Me.ucrNudFillScaleMapBegins.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrInputFillScaleColour + ' + Me.ucrInputFillScaleColour.AddQuotesIfUnrecognised = True + Me.ucrInputFillScaleColour.GetSetSelectedIndex = -1 + Me.ucrInputFillScaleColour.IsReadOnly = False + resources.ApplyResources(Me.ucrInputFillScaleColour, "ucrInputFillScaleColour") + Me.ucrInputFillScaleColour.Name = "ucrInputFillScaleColour" + ' + 'ucrChkFilLScaleReverseColourOrder + ' + Me.ucrChkFilLScaleReverseColourOrder.Checked = False + resources.ApplyResources(Me.ucrChkFilLScaleReverseColourOrder, "ucrChkFilLScaleReverseColourOrder") + Me.ucrChkFilLScaleReverseColourOrder.Name = "ucrChkFilLScaleReverseColourOrder" + ' + 'ucrChkFillScaleDiscrete + ' + Me.ucrChkFillScaleDiscrete.Checked = False + resources.ApplyResources(Me.ucrChkFillScaleDiscrete, "ucrChkFillScaleDiscrete") + Me.ucrChkFillScaleDiscrete.Name = "ucrChkFillScaleDiscrete" + ' + 'lblFillScaleMapEnds + ' + resources.ApplyResources(Me.lblFillScaleMapEnds, "lblFillScaleMapEnds") + Me.lblFillScaleMapEnds.Name = "lblFillScaleMapEnds" + ' + 'lblFillScaleBeginColour + ' + resources.ApplyResources(Me.lblFillScaleBeginColour, "lblFillScaleBeginColour") + Me.lblFillScaleBeginColour.Name = "lblFillScaleBeginColour" + ' + 'lblFillScaleColourPalettte + ' + resources.ApplyResources(Me.lblFillScaleColourPalettte, "lblFillScaleColourPalettte") + Me.lblFillScaleColourPalettte.Name = "lblFillScaleColourPalettte" + ' + 'lblFillScaleTransparency + ' + resources.ApplyResources(Me.lblFillScaleTransparency, "lblFillScaleTransparency") + Me.lblFillScaleTransparency.Name = "lblFillScaleTransparency" + ' 'ucrBaseSubdialog ' resources.ApplyResources(Me.ucrBaseSubdialog, "ucrBaseSubdialog") Me.ucrBaseSubdialog.Name = "ucrBaseSubdialog" ' - 'ucrChkDrop - ' - Me.ucrChkDrop.Checked = False - resources.ApplyResources(Me.ucrChkDrop, "ucrChkDrop") - Me.ucrChkDrop.Name = "ucrChkDrop" - ' 'sdgPlots ' resources.ApplyResources(Me, "$this") @@ -682,6 +913,11 @@ Partial Class sdgPlots Me.tbpCoordinates.ResumeLayout(False) Me.grpPolarCordinates.ResumeLayout(False) Me.grpPolarCordinates.PerformLayout() + Me.tbpColour.ResumeLayout(False) + Me.grpColourScale.ResumeLayout(False) + Me.grpColourScale.PerformLayout() + Me.grpFillScale.ResumeLayout(False) + Me.grpFillScale.PerformLayout() Me.ResumeLayout(False) End Sub @@ -758,6 +994,32 @@ Partial Class sdgPlots Friend WithEvents ucrInputPolarCoordinates As ucrInputComboBox Friend WithEvents lblPolarCoordinate As Label Friend WithEvents ucrChkDrop As ucrCheck + Friend WithEvents tbpColour As TabPage + Friend WithEvents grpFillScale As GroupBox + Friend WithEvents lblFillScaleMapEnds As Label + Friend WithEvents lblFillScaleBeginColour As Label + Friend WithEvents lblFillScaleColourPalettte As Label + Friend WithEvents lblFillScaleTransparency As Label + Friend WithEvents ucrChkFilLScaleReverseColourOrder As ucrCheck + Friend WithEvents ucrChkFillScaleDiscrete As ucrCheck + Friend WithEvents grpColourScale As GroupBox + Friend WithEvents ucrNudColourScaleTransparency As ucrNud + Friend WithEvents ucrInputColourScalePalette As ucrInputComboBox + Friend WithEvents ucrNudColourScaleMapEnds As ucrNud + Friend WithEvents ucrNudColourScaleMapBegins As ucrNud + Friend WithEvents ucrChkColourScaleReverseOrder As ucrCheck + Friend WithEvents ucrChkColourScaleDiscrete As ucrCheck + Friend WithEvents lblColourScaleMapEnds As Label + Friend WithEvents lblColourScaleMapBegins As Label + Friend WithEvents lblColourScalePalette As Label + Friend WithEvents lblColourScaleTransparency As Label + Friend WithEvents UcrChkChangeColourScale As ucrCheck + Friend WithEvents ucrNudFillScaleTransparency As ucrNud + Friend WithEvents ucrNudFillScaleMapEnds As ucrNud + Friend WithEvents ucrNudFillScaleMapBegins As ucrNud + Friend WithEvents ucrInputFillScaleColour As ucrInputComboBox + Friend WithEvents ucrChkAddFillScale As ucrCheck + Friend WithEvents ucrChkAddColourScale As ucrCheck End Class diff --git a/instat/sdgPlots.resx b/instat/sdgPlots.resx index 449046bbbe5..934e82618fd 100644 --- a/instat/sdgPlots.resx +++ b/instat/sdgPlots.resx @@ -529,7 +529,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 3 @@ -577,7 +577,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 4 @@ -928,7 +928,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 2 @@ -976,7 +976,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 5 @@ -1024,7 +1024,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 6 @@ -1450,7 +1450,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 1 @@ -1714,7 +1714,7 @@ 3, 3, 3, 3 - 499, 330 + 499, 423 7 @@ -1734,11 +1734,638 @@ 6 + + 20, 197 + + + 100, 20 + + + 27 + + + ucrChkAddColourScale + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + tbpColour + + + 0 + + + 23, 6 + + + 100, 20 + + + 26 + + + ucrChkAddFillScale + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + tbpColour + + + 1 + + + 222, 46 + + + 50, 20 + + + 11 + + + ucrNudColourScaleTransparency + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpColourScale + + + 0 + + + 222, 19 + + + 137, 21 + + + 10 + + + ucrInputColourScalePalette + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpColourScale + + + 1 + + + 222, 100 + + + 50, 20 + + + 9 + + + ucrNudColourScaleMapEnds + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpColourScale + + + 2 + + + 222, 73 + + + 50, 20 + + + 8 + + + ucrNudColourScaleMapBegins + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpColourScale + + + 3 + + + 7, 123 + + + 100, 18 + + + 5 + + + ucrChkColourScaleReverseOrder + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpColourScale + + + 4 + + + 7, 146 + + + 100, 26 + + + 4 + + + ucrChkColourScaleDiscrete + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpColourScale + + + 5 + + + True + + + NoControl + + + 7, 99 + + + 198, 13 + + + 3 + + + Corrected Hue Where Colour Map Ends: + + + lblColourScaleMapEnds + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpColourScale + + + 6 + + + True + + + NoControl + + + 7, 75 + + + 209, 13 + + + 2 + + + Corrected Hue Where Colour Map Begins: + + + lblColourScaleMapBegins + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpColourScale + + + 7 + + + True + + + NoControl + + + 7, 27 + + + 76, 13 + + + 1 + + + Colour Palette: + + + lblColourScalePalette + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpColourScale + + + 8 + + + True + + + NoControl + + + 7, 51 + + + 75, 13 + + + 0 + + + Transparency: + + + lblColourScaleTransparency + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpColourScale + + + 9 + + + 13, 243 + + + 390, 172 + + + 25 + + + Colour Scale + + + grpColourScale + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tbpColour + + + 2 + + + 20, 217 + + + 100, 20 + + + 24 + + + UcrChkChangeColourScale + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + tbpColour + + + 3 + + + 222, 46 + + + 50, 21 + + + 9 + + + ucrNudFillScaleTransparency + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpFillScale + + + 0 + + + 222, 100 + + + 50, 22 + + + 8 + + + ucrNudFillScaleMapEnds + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpFillScale + + + 1 + + + 222, 73 + + + 50, 27 + + + 7 + + + ucrNudFillScaleMapBegins + + + instat.ucrNud, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpFillScale + + + 2 + + + 222, 19 + + + 137, 25 + + + 6 + + + ucrInputFillScaleColour + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpFillScale + + + 3 + + + 7, 118 + + + 100, 20 + + + 5 + + + ucrChkFilLScaleReverseColourOrder + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpFillScale + + + 4 + + + 7, 141 + + + 100, 20 + + + 4 + + + ucrChkFillScaleDiscrete + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpFillScale + + + 5 + + + True + + + NoControl + + + 7, 95 + + + 198, 13 + + + 3 + + + Corrected Hue Where Colour Map Ends: + + + lblFillScaleMapEnds + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpFillScale + + + 6 + + + True + + + NoControl + + + 7, 72 + + + 209, 13 + + + 2 + + + Corrected Hue Where Colour Map Begins: + + + lblFillScaleBeginColour + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpFillScale + + + 7 + + + True + + + NoControl + + + 7, 26 + + + 76, 13 + + + 1 + + + Colour Palette: + + + lblFillScaleColourPalettte + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpFillScale + + + 8 + + + True + + + 7, 49 + + + 75, 13 + + + 0 + + + Transparency: + + + lblFillScaleTransparency + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpFillScale + + + 9 + + + 13, 30 + + + 388, 160 + + + 23 + + + Fill Scale + + + grpFillScale + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tbpColour + + + 4 + + + 4, 22 + + + 3, 3, 3, 3 + + + 499, 423 + + + 8 + + + Colour + + + tbpColour + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tbpPlotsOptions + + + 7 + 1, 3 - 507, 356 + 507, 449 0 @@ -1756,10 +2383,10 @@ 1 - 164, 365 + 164, 458 - 160, 41 + 160, 28 1 @@ -1783,7 +2410,7 @@ 6, 13 - 517, 399 + 517, 502 CenterParent diff --git a/instat/sdgPlots.vb b/instat/sdgPlots.vb index 7d65ef46483..82e954882be 100644 --- a/instat/sdgPlots.vb +++ b/instat/sdgPlots.vb @@ -14,6 +14,7 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . +Imports instat Imports instat.Translations Public Class sdgPlots 'Question to be discussed (later: need to explore first)/Exploration Task: In order to uniformise the code, could create a PlotOptionsSetup where all the necessary links between specific plots and plot options are made ? For the moment all these are scattered around. Might be necessary to have this flexibility though... @@ -33,6 +34,8 @@ Public Class sdgPlots Public clsXScaleDateFunction As New RFunction Public clsYScaleDateFunction As New RFunction Public clsYLabFunction As New RFunction + Public clsScaleColourViridisFunction As New RFunction + Public clsScaleFillViridisFunction As New RFunction Public clsBaseOperator As New ROperator Private bControlsInitialised As Boolean = False 'All the previous RFunctions will eventually be stored as parameters (or parameters of parameters) within the RSyntax building the big Ggplot command "ggplot(...) + geom_..(..) + ... + theme(...) + scales(...) ..." @@ -71,6 +74,8 @@ Public Class sdgPlots Public Sub InitialiseControls() Dim dctThemes As New Dictionary(Of String, String) Dim dctLegendPosition As New Dictionary(Of String, String) + Dim dctOptions As New Dictionary(Of String, String) + Dim strThemes As String() Dim clsCoordFlipFunc As New RFunction @@ -331,9 +336,54 @@ Public Class sdgPlots ucrChkDrop.SetValuesCheckedAndUnchecked("TRUE", "FALSE") ucrChkDrop.SetText("Drop empty factor levels") ucrChkDrop.SetRDefault("TRUE") - End Sub - Public Sub SetRCode(clsNewOperator As ROperator, clsNewCoordPolarFunction As RFunction, clsNewCoordPolarStartOperator As ROperator, clsNewYScalecontinuousFunction As RFunction, clsNewXScalecontinuousFunction As RFunction, clsNewLabsFunction As RFunction, clsNewXLabsTitleFunction As RFunction, clsNewYLabTitleFunction As RFunction, clsNewFacetFunction As RFunction, clsNewThemeFunction As RFunction, dctNewThemeFunctions As Dictionary(Of String, RFunction), ucrNewBaseSelector As ucrSelector, bReset As Boolean, Optional clsNewGlobalAesFunction As RFunction = Nothing, Optional clsNewXScaleDateFunction As RFunction = Nothing, Optional clsNewYScaleDateFunction As RFunction = Nothing, Optional strMainDialogGeomParameterNames() As String = Nothing) + 'Colour + ucrInputFillScaleColour.SetParameter(New RParameter("option", iNewPosition:=0)) + dctOptions.Add("viridis", Chr(34) & "viridis" & Chr(34)) + dctOptions.Add("magma", Chr(34) & "magma" & Chr(34)) + dctOptions.Add("inferno", Chr(34) & "inferno" & Chr(34)) + dctOptions.Add("plasma", Chr(34) & "plasma" & Chr(34)) + dctOptions.Add("cividis", Chr(34) & "cividis" & Chr(34)) + ucrInputFillScaleColour.SetItems(dctOptions) + ucrInputFillScaleColour.SetLinkedDisplayControl(lblFillScaleColourPalettte) + + ucrNudFillScaleTransparency.SetParameter(New RParameter("alpha", iNewPosition:=1)) + ucrNudFillScaleTransparency.SetMinMax(0, 1) + ucrNudFillScaleTransparency.DecimalPlaces = 2 + ucrNudFillScaleTransparency.Increment = 0.01 + ucrNudFillScaleTransparency.SetLinkedDisplayControl(lblFillScaleTransparency) + + ucrNudFillScaleMapBegins.SetParameter(New RParameter("begin", iNewPosition:=2)) + ucrNudFillScaleMapBegins.SetMinMax(0, 1) + ucrNudFillScaleMapBegins.DecimalPlaces = 2 + ucrNudFillScaleMapBegins.Increment = 0.01 + ucrNudFillScaleMapBegins.SetLinkedDisplayControl(lblFillScaleBeginColour) + + ucrNudFillScaleMapEnds.SetParameter(New RParameter("end", iNewPosition:=3)) + ucrNudFillScaleMapEnds.SetMinMax(0, 1) + ucrNudFillScaleMapEnds.DecimalPlaces = 2 + ucrNudFillScaleMapEnds.Increment = 0.01 + ucrNudFillScaleMapEnds.SetLinkedDisplayControl(lblFillScaleMapEnds) + + ucrChkFilLScaleReverseColourOrder.SetParameter(New RParameter("direction", iNewPosition:=4)) + ucrChkFilLScaleReverseColourOrder.SetText("Reverse Order Of Colours") + ucrChkFilLScaleReverseColourOrder.SetValuesCheckedAndUnchecked("1", "-1") + + ucrChkAddFillScale.SetText("Add Fill Scale") + ucrChkAddFillScale.AddParameterPresentCondition(True, "scale_fill", True) + ucrChkAddFillScale.AddParameterPresentCondition(False, "scale_fill", False) + + ucrChkAddColourScale.SetText("Add Colour Scale") + ucrChkAddColourScale.AddParameterPresentCondition(True, "scale_colour", True) + ucrChkAddColourScale.AddParameterPresentCondition(False, "scale_colour", False) + + grpFillScale.Visible = False + grpColourScale.Visible = False + + End Sub + + Public Sub SetRCode(clsNewOperator As ROperator, clsNewCoordPolarFunction As RFunction, clsNewCoordPolarStartOperator As ROperator, clsNewYScalecontinuousFunction As RFunction, clsNewXScalecontinuousFunction As RFunction, clsNewLabsFunction As RFunction, clsNewXLabsTitleFunction As RFunction, clsNewYLabTitleFunction As RFunction, clsNewFacetFunction As RFunction, clsNewThemeFunction As RFunction, dctNewThemeFunctions As Dictionary(Of String, RFunction), ucrNewBaseSelector As ucrSelector, bReset As Boolean, Optional clsNewGlobalAesFunction As RFunction = Nothing, Optional clsNewXScaleDateFunction As RFunction = Nothing, Optional clsNewYScaleDateFunction As RFunction = Nothing, + Optional clsNewScaleFillViridisFunction As RFunction = Nothing, Optional clsNewScaleColourViridisFunction As RFunction = Nothing, Optional strMainDialogGeomParameterNames() As String = Nothing) Dim clsTempParam As RParameter bRCodeSet = False @@ -360,6 +410,9 @@ Public Class sdgPlots clsThemeFunction = clsNewThemeFunction clsCoordPolarFunc = clsNewCoordPolarFunction clsCoordPolarStartOperator = clsNewCoordPolarStartOperator + clsScaleFillViridisFunction = clsNewScaleFillViridisFunction + clsScaleColourViridisFunction = clsNewScaleColourViridisFunction + If Not IsNothing(clsCoordPolarStartOperator) Then clsCoordPolarFunc.AddParameter("start", clsROperatorParameter:=clsCoordPolarStartOperator, iPosition:=1) End If @@ -426,6 +479,15 @@ Public Class sdgPlots ucrInputStartingAngle.SetRCode(clsCoordPolarStartOperator, bReset, bCloneIfNeeded:=True) ucrInputPolarCoordinates.SetRCode(clsCoordPolarFunc, bReset:=True, bCloneIfNeeded:=True) + 'colour + ucrInputFillScaleColour.SetRCode(clsScaleFillViridisFunction, bReset, bCloneIfNeeded:=True) + ucrNudFillScaleTransparency.SetRCode(clsScaleFillViridisFunction, bReset, bCloneIfNeeded:=True) + ucrNudFillScaleMapBegins.SetRCode(clsScaleFillViridisFunction, bReset, bCloneIfNeeded:=True) + ucrNudFillScaleMapEnds.SetRCode(clsScaleFillViridisFunction, bReset, bCloneIfNeeded:=True) + ucrChkFilLScaleReverseColourOrder.SetRCode(clsScaleFillViridisFunction, bReset, bCloneIfNeeded:=True) + ucrChkAddFillScale.SetRCode(clsBaseOperator, bReset, bCloneIfNeeded:=True) + ucrChkAddColourScale.SetRCode(clsBaseOperator, bReset, bCloneIfNeeded:=True) + ucrPlotsAdditionalLayers.SetRCodeForControl(clsNewBaseOperator:=clsBaseOperator, clsRNewggplotFunc:=clsRggplotFunction, clsNewAesFunc:=clsGlobalAesFunction, strNewGlobalDataFrame:=strDataFrame, strMainDialogGeomParameterNames:=strMainDialogGeomParameterNames, bReset:=bReset) bRCodeSet = True AddRemoveLabs() @@ -787,4 +849,23 @@ Public Class sdgPlots End If End Sub + Private Sub ucrChkAddColoutPalette_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddFillScale.ControlValueChanged + If ucrChkAddFillScale.Checked Then + clsBaseOperator.AddParameter("scale_fill", clsRFunctionParameter:=clsScaleFillViridisFunction, iPosition:=3) + grpFillScale.Visible = True + Else + clsBaseOperator.RemoveParameterByName("scale_fill") + grpFillScale.Visible = False + End If + End Sub + + Private Sub ucrChkAddColourScale_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkAddColourScale.ControlValueChanged + If ucrChkAddColourScale.Checked Then + clsBaseOperator.AddParameter("scale_colour", clsRFunctionParameter:=clsScaleColourViridisFunction, iPosition:=4) + grpColourScale.Visible = True + Else + clsBaseOperator.RemoveParameterByName("scale_colour") + grpColourScale.Visible = False + End If + End Sub End Class \ No newline at end of file