diff --git a/instat/dlgTreemap.Designer.vb b/instat/dlgTreemap.Designer.vb new file mode 100644 index 00000000000..219ef142d49 --- /dev/null +++ b/instat/dlgTreemap.Designer.vb @@ -0,0 +1,291 @@ + _ +Partial Class dlgTreemap + 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 + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + '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() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgTreemap)) + Me.lblLabel = New System.Windows.Forms.Label() + Me.rdoPrimary = New System.Windows.Forms.RadioButton() + Me.rdoSummary = New System.Windows.Forms.RadioButton() + Me.cmdOptions = New System.Windows.Forms.Button() + Me.lblWeightBy = New System.Windows.Forms.Label() + Me.lblIdentifier = New System.Windows.Forms.Label() + Me.lblSymbol = New System.Windows.Forms.Label() + Me.lblFill = New System.Windows.Forms.Label() + Me.grpOptions = New System.Windows.Forms.GroupBox() + Me.lblTextColour = New System.Windows.Forms.Label() + Me.lblTileColour = New System.Windows.Forms.Label() + Me.lblSummary = New System.Windows.Forms.Label() + Me.ucrInputSummary = New instat.ucrInputComboBox() + Me.ucrColourText = New instat.ucrColors() + Me.ucrColourTile = New instat.ucrColors() + Me.ucrReceiverFill = New instat.ucrReceiverSingle() + Me.ucrInputSymbol = New instat.ucrInputTextBox() + Me.ucrInputLabel = New instat.ucrInputComboBox() + Me.ucrSaveTreemap = New instat.ucrSave() + Me.ucrChkIsCurrency = New instat.ucrCheck() + Me.ucrReceiverWeightBy = New instat.ucrReceiverSingle() + Me.ucrReceiverIdentifier = New instat.ucrReceiverSingle() + Me.ucrSelectorTreemap = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrBase = New instat.ucrButtons() + Me.ucrPnlDataType = New instat.UcrPanel() + Me.grpOptions.SuspendLayout() + Me.SuspendLayout() + ' + 'lblLabel + ' + resources.ApplyResources(Me.lblLabel, "lblLabel") + Me.lblLabel.Name = "lblLabel" + ' + 'rdoPrimary + ' + resources.ApplyResources(Me.rdoPrimary, "rdoPrimary") + Me.rdoPrimary.BackColor = System.Drawing.SystemColors.Control + Me.rdoPrimary.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoPrimary.FlatAppearance.BorderSize = 2 + Me.rdoPrimary.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoPrimary.Name = "rdoPrimary" + Me.rdoPrimary.TabStop = True + Me.rdoPrimary.Tag = "" + Me.rdoPrimary.UseVisualStyleBackColor = False + ' + 'rdoSummary + ' + resources.ApplyResources(Me.rdoSummary, "rdoSummary") + Me.rdoSummary.BackColor = System.Drawing.SystemColors.Control + Me.rdoSummary.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSummary.FlatAppearance.BorderSize = 2 + Me.rdoSummary.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSummary.Name = "rdoSummary" + Me.rdoSummary.TabStop = True + Me.rdoSummary.Tag = "Pie_Chart" + Me.rdoSummary.UseVisualStyleBackColor = False + ' + 'cmdOptions + ' + resources.ApplyResources(Me.cmdOptions, "cmdOptions") + Me.cmdOptions.Name = "cmdOptions" + Me.cmdOptions.Tag = "Plot_Options..." + Me.cmdOptions.UseVisualStyleBackColor = True + ' + 'lblWeightBy + ' + resources.ApplyResources(Me.lblWeightBy, "lblWeightBy") + Me.lblWeightBy.Name = "lblWeightBy" + Me.lblWeightBy.Tag = "" + ' + 'lblIdentifier + ' + resources.ApplyResources(Me.lblIdentifier, "lblIdentifier") + Me.lblIdentifier.Name = "lblIdentifier" + Me.lblIdentifier.Tag = "Variable:" + ' + 'lblSymbol + ' + resources.ApplyResources(Me.lblSymbol, "lblSymbol") + Me.lblSymbol.Name = "lblSymbol" + ' + 'lblFill + ' + resources.ApplyResources(Me.lblFill, "lblFill") + Me.lblFill.Name = "lblFill" + Me.lblFill.Tag = "" + ' + 'grpOptions + ' + Me.grpOptions.Controls.Add(Me.lblTextColour) + Me.grpOptions.Controls.Add(Me.ucrColourText) + Me.grpOptions.Controls.Add(Me.lblTileColour) + Me.grpOptions.Controls.Add(Me.ucrColourTile) + resources.ApplyResources(Me.grpOptions, "grpOptions") + Me.grpOptions.Name = "grpOptions" + Me.grpOptions.TabStop = False + ' + 'lblTextColour + ' + resources.ApplyResources(Me.lblTextColour, "lblTextColour") + Me.lblTextColour.Name = "lblTextColour" + ' + 'lblTileColour + ' + resources.ApplyResources(Me.lblTileColour, "lblTileColour") + Me.lblTileColour.Name = "lblTileColour" + ' + 'lblSummary + ' + resources.ApplyResources(Me.lblSummary, "lblSummary") + Me.lblSummary.Name = "lblSummary" + ' + 'ucrInputSummary + ' + Me.ucrInputSummary.AddQuotesIfUnrecognised = True + Me.ucrInputSummary.IsReadOnly = False + resources.ApplyResources(Me.ucrInputSummary, "ucrInputSummary") + Me.ucrInputSummary.Name = "ucrInputSummary" + ' + 'ucrColourText + ' + Me.ucrColourText.AddQuotesIfUnrecognised = True + Me.ucrColourText.IsReadOnly = False + resources.ApplyResources(Me.ucrColourText, "ucrColourText") + Me.ucrColourText.Name = "ucrColourText" + ' + 'ucrColourTile + ' + Me.ucrColourTile.AddQuotesIfUnrecognised = True + Me.ucrColourTile.IsReadOnly = False + resources.ApplyResources(Me.ucrColourTile, "ucrColourTile") + Me.ucrColourTile.Name = "ucrColourTile" + ' + 'ucrReceiverFill + ' + Me.ucrReceiverFill.frmParent = Me + resources.ApplyResources(Me.ucrReceiverFill, "ucrReceiverFill") + Me.ucrReceiverFill.Name = "ucrReceiverFill" + Me.ucrReceiverFill.Selector = Nothing + Me.ucrReceiverFill.strNcFilePath = "" + Me.ucrReceiverFill.ucrSelector = Nothing + ' + 'ucrInputSymbol + ' + Me.ucrInputSymbol.AddQuotesIfUnrecognised = True + Me.ucrInputSymbol.IsMultiline = False + Me.ucrInputSymbol.IsReadOnly = False + resources.ApplyResources(Me.ucrInputSymbol, "ucrInputSymbol") + Me.ucrInputSymbol.Name = "ucrInputSymbol" + ' + 'ucrInputLabel + ' + Me.ucrInputLabel.AddQuotesIfUnrecognised = True + Me.ucrInputLabel.IsReadOnly = False + resources.ApplyResources(Me.ucrInputLabel, "ucrInputLabel") + Me.ucrInputLabel.Name = "ucrInputLabel" + ' + 'ucrSaveTreemap + ' + resources.ApplyResources(Me.ucrSaveTreemap, "ucrSaveTreemap") + Me.ucrSaveTreemap.Name = "ucrSaveTreemap" + ' + 'ucrChkIsCurrency + ' + Me.ucrChkIsCurrency.Checked = False + resources.ApplyResources(Me.ucrChkIsCurrency, "ucrChkIsCurrency") + Me.ucrChkIsCurrency.Name = "ucrChkIsCurrency" + ' + 'ucrReceiverWeightBy + ' + Me.ucrReceiverWeightBy.frmParent = Me + resources.ApplyResources(Me.ucrReceiverWeightBy, "ucrReceiverWeightBy") + Me.ucrReceiverWeightBy.Name = "ucrReceiverWeightBy" + Me.ucrReceiverWeightBy.Selector = Nothing + Me.ucrReceiverWeightBy.strNcFilePath = "" + Me.ucrReceiverWeightBy.ucrSelector = Nothing + ' + 'ucrReceiverIdentifier + ' + Me.ucrReceiverIdentifier.frmParent = Me + resources.ApplyResources(Me.ucrReceiverIdentifier, "ucrReceiverIdentifier") + Me.ucrReceiverIdentifier.Name = "ucrReceiverIdentifier" + Me.ucrReceiverIdentifier.Selector = Nothing + Me.ucrReceiverIdentifier.strNcFilePath = "" + Me.ucrReceiverIdentifier.ucrSelector = Nothing + ' + 'ucrSelectorTreemap + ' + Me.ucrSelectorTreemap.bDropUnusedFilterLevels = False + Me.ucrSelectorTreemap.bShowHiddenColumns = False + Me.ucrSelectorTreemap.bUseCurrentFilter = True + resources.ApplyResources(Me.ucrSelectorTreemap, "ucrSelectorTreemap") + Me.ucrSelectorTreemap.Name = "ucrSelectorTreemap" + ' + 'ucrBase + ' + resources.ApplyResources(Me.ucrBase, "ucrBase") + Me.ucrBase.Name = "ucrBase" + ' + 'ucrPnlDataType + ' + resources.ApplyResources(Me.ucrPnlDataType, "ucrPnlDataType") + Me.ucrPnlDataType.Name = "ucrPnlDataType" + ' + 'dlgTreemap + ' + resources.ApplyResources(Me, "$this") + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.ucrInputSummary) + Me.Controls.Add(Me.lblSummary) + Me.Controls.Add(Me.grpOptions) + Me.Controls.Add(Me.lblFill) + Me.Controls.Add(Me.ucrReceiverFill) + Me.Controls.Add(Me.ucrInputSymbol) + Me.Controls.Add(Me.lblSymbol) + Me.Controls.Add(Me.lblLabel) + Me.Controls.Add(Me.ucrInputLabel) + Me.Controls.Add(Me.ucrSaveTreemap) + Me.Controls.Add(Me.ucrChkIsCurrency) + Me.Controls.Add(Me.rdoPrimary) + Me.Controls.Add(Me.rdoSummary) + Me.Controls.Add(Me.cmdOptions) + Me.Controls.Add(Me.lblWeightBy) + Me.Controls.Add(Me.lblIdentifier) + Me.Controls.Add(Me.ucrReceiverWeightBy) + Me.Controls.Add(Me.ucrReceiverIdentifier) + Me.Controls.Add(Me.ucrSelectorTreemap) + Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.ucrPnlDataType) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "dlgTreemap" + Me.grpOptions.ResumeLayout(False) + Me.grpOptions.PerformLayout() + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents lblLabel As Label + Friend WithEvents ucrInputLabel As ucrInputComboBox + Friend WithEvents ucrSaveTreemap As ucrSave + Friend WithEvents ucrChkIsCurrency As ucrCheck + Friend WithEvents rdoPrimary As RadioButton + Friend WithEvents rdoSummary As RadioButton + Friend WithEvents cmdOptions As Button + Friend WithEvents lblWeightBy As Label + Friend WithEvents lblIdentifier As Label + Friend WithEvents ucrReceiverWeightBy As ucrReceiverSingle + Friend WithEvents ucrReceiverIdentifier As ucrReceiverSingle + Friend WithEvents ucrSelectorTreemap As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrBase As ucrButtons + Friend WithEvents ucrPnlDataType As UcrPanel + Friend WithEvents ucrInputSymbol As ucrInputTextBox + Friend WithEvents lblSymbol As Label + Friend WithEvents lblFill As Label + Friend WithEvents ucrReceiverFill As ucrReceiverSingle + Friend WithEvents grpOptions As GroupBox + Friend WithEvents lblTextColour As Label + Friend WithEvents ucrColourText As ucrColors + Friend WithEvents lblTileColour As Label + Friend WithEvents ucrColourTile As ucrColors + Friend WithEvents lblSummary As Label + Friend WithEvents ucrInputSummary As ucrInputComboBox +End Class diff --git a/instat/dlgTreemap.resx b/instat/dlgTreemap.resx new file mode 100644 index 00000000000..c5ad0ac0ca3 --- /dev/null +++ b/instat/dlgTreemap.resx @@ -0,0 +1,798 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + True + + + + NoControl + + + + 251, 226 + + + 36, 13 + + + 23 + + + Label: + + + lblLabel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 7 + + + Button + + + Flat + + + NoControl + + + 97, 11 + + + 110, 28 + + + 16 + + + Primary data + + + MiddleCenter + + + rdoPrimary + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 11 + + + Button + + + Flat + + + NoControl + + + 205, 11 + + + 110, 28 + + + 17 + + + Summary data + + + MiddleCenter + + + rdoSummary + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 12 + + + NoControl + + + 9, 232 + + + 121, 25 + + + 27 + + + Options + + + cmdOptions + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 13 + + + True + + + NoControl + + + 254, 111 + + + 107, 13 + + + 21 + + + Weight By (Optional): + + + lblWeightBy + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 14 + + + True + + + NoControl + + + 254, 61 + + + 50, 13 + + + 19 + + + Identifier: + + + lblIdentifier + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 15 + + + True + + + NoControl + + + 272, 203 + + + 44, 13 + + + 31 + + + Symbol: + + + lblSymbol + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + + + True + + + NoControl + + + 254, 277 + + + 22, 13 + + + 33 + + + Fill: + + + lblFill + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + True + + + NoControl + + + 9, 54 + + + 63, 13 + + + 38 + + + Text colour: + + + lblTextColour + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpOptions + + + 0 + + + 80, 52 + + + 137, 21 + + + 37 + + + ucrColourText + + + instat.ucrColors, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpOptions + + + 1 + + + True + + + NoControl + + + 9, 23 + + + 59, 13 + + + 36 + + + Tile colour: + + + lblTileColour + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + grpOptions + + + 2 + + + 80, 21 + + + 137, 21 + + + 0 + + + ucrColourTile + + + instat.ucrColors, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + grpOptions + + + 3 + + + 9, 293 + + + 230, 81 + + + 35 + + + Options + + + grpOptions + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + True + + + NoControl + + + 252, 156 + + + 53, 13 + + + 36 + + + Summary: + + + lblSummary + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + 307, 154 + + + 67, 21 + + + 37 + + + ucrInputSummary + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 0 + + + True + + + 6, 13 + + + 418, 464 + + + 323, 201 + + + 51, 21 + + + 32 + + + ucrInputSymbol + + + instat.ucrInputTextBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 5 + + + 254, 244 + + + 21, 17, 21, 17 + + + 120, 21 + + + 25 + + + ucrInputLabel + + + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 8 + + + 9, 380 + + + 255, 24 + + + 29 + + + ucrSaveTreemap + + + instat.ucrSave, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 9 + + + 254, 180 + + + 82, 20 + + + 28 + + + ucrChkIsCurrency + + + instat.ucrCheck, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 10 + + + 254, 126 + + + 0, 0, 0, 0 + + + 120, 20 + + + 22 + + + ucrReceiverWeightBy + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 16 + + + 254, 76 + + + 0, 0, 0, 0 + + + 120, 20 + + + 20 + + + ucrReceiverIdentifier + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 17 + + + 9, 40 + + + 0, 0, 0, 0 + + + 210, 180 + + + 18 + + + ucrSelectorTreemap + + + instat.ucrSelectorByDataFrameAddRemove, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 18 + + + 9, 410 + + + 410, 52 + + + 30 + + + ucrBase + + + instat.ucrButtons, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 19 + + + 86, 5 + + + 241, 36 + + + 15 + + + ucrPnlDataType + + + instat.UcrPanel, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 20 + + + NoControl + + + CenterScreen + + + Treemap + + + dlgTreemap + + + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 254, 292 + + + 0, 0, 0, 0 + + + 120, 20 + + + 34 + + + ucrReceiverFill + + + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 4 + + \ No newline at end of file diff --git a/instat/dlgTreemap.vb b/instat/dlgTreemap.vb new file mode 100644 index 00000000000..d46f2f09fb5 --- /dev/null +++ b/instat/dlgTreemap.vb @@ -0,0 +1,445 @@ +' R- Instat +' Copyright (C) 2015-2017 +' +' 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 +' along with this program. If not, see . + +Imports instat +Imports instat.Translations + +Public Class dlgTreemap + Private clsBaseOperator As New ROperator + + Private clsPipeOperator As New ROperator + Private clsGroupByFunction As New RFunction + Private clsSummariseFunction As New RFunction + Private clsSummaryFunction As New RFunction + + Private clsGgplotFunction As New RFunction + Private clsGeomTreemapFunction As New RFunction + Private clsGeomTreemapAesFunction As New RFunction + Private clsGeomTreemapTextFunction As New RFunction + Private clsGeomTreemapTextAesFunction As New RFunction + + Private clsPaste0Function As New RFunction + Private clsDollarFunction As New RFunction + + Private clsLocalAesFunction As New RFunction + + Private clsRCoordPolarParam As New RParameter + Private clsLabsFunction As New RFunction + Private clsXlabFunction As New RFunction + Private clsYlabFunction As New RFunction + Private clsXScalecontinuousFunction As New RFunction + Private clsYScalecontinuousFunction As New RFunction + Private clsRFacetFunction As New RFunction + Private clsCoordPolarFunction As New RFunction + Private clsCoordPolarStartOperator As New ROperator + Private clsThemeFuction As New RFunction + Private dctThemeFunctions As New Dictionary(Of String, RFunction) + + Private strIdentifier As String = "Identifier" + Private strIdentifierAndWeighty As String = "Identifier & Weight" + Private strWeight As String = "Weight" + Private strNone As String = "None" + + Private bReset As Boolean = True + Private bFirstLoad As Boolean = True + Private bRCodeSet As Boolean = False + Private bResetSubdialog As Boolean = True + + Private Sub dlgTreemap_Load(sender As Object, e As EventArgs) Handles MyBase.Load + If bFirstLoad Then + InitialiseDialog() + bFirstLoad = False + End If + If bReset Then + SetDefaults() + End If + SetRCodeForControls(bReset) + bReset = False + autoTranslate(Me) + TestOkEnabled() + End Sub + + Private Sub InitialiseDialog() + ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False + ucrBase.clsRsyntax.iCallType = 3 + 'ucrBase.iHelpTopicID = + + ucrPnlDataType.AddRadioButton(rdoPrimary) + ucrPnlDataType.AddRadioButton(rdoSummary) + ucrPnlDataType.AddParameterPresentCondition(rdoPrimary, "group_by", True) + ucrPnlDataType.AddParameterPresentCondition(rdoSummary, "group_by", False) + + ucrSelectorTreemap.SetParameter(New RParameter("data", 0)) + ucrSelectorTreemap.SetParameterIsrfunction() + + ucrReceiverIdentifier.Selector = ucrSelectorTreemap + ucrReceiverIdentifier.SetParameter(New RParameter("0", 0, bNewIncludeArgumentName:=False)) + ucrReceiverIdentifier.bWithQuotes = False + ucrReceiverIdentifier.SetParameterIsString() + + ucrReceiverWeightBy.Selector = ucrSelectorTreemap + ucrReceiverWeightBy.SetIncludedDataTypes({"numeric"}) + ucrReceiverWeightBy.strSelectorHeading = "Numerics" + ucrReceiverWeightBy.SetParameter(New RParameter("area", 1)) + ucrReceiverWeightBy.bWithQuotes = False + ucrReceiverWeightBy.SetParameterIsString() + ucrReceiverWeightBy.SetValuesToIgnore({".n"}) + + ucrInputSummary.SetItems({"sum", "mean", "min", "max"}) + ucrInputSummary.AddQuotesIfUnrecognised = False + ucrInputSummary.SetLinkedDisplayControl(lblSummary) + ucrInputSummary.SetValidationTypeAsRVariable() + + ucrChkIsCurrency.SetText("Is Currency") + ucrChkIsCurrency.SetParameter(New RParameter("dollar", iNewPosition:=2, bNewIncludeArgumentName:=False), bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) + ucrChkIsCurrency.AddToLinkedControls(ucrInputSymbol, {True}, bNewLinkedHideIfParameterMissing:=True) + + ucrInputSymbol.SetParameter(New RParameter("prefix", 3)) + ucrInputSymbol.SetLinkedDisplayControl(lblSymbol) + + ucrInputLabel.SetItems({strIdentifier, strIdentifierAndWeighty, strWeight, strNone}) + ucrInputLabel.AddParameterPresentCondition(strIdentifier, "identifier") + ucrInputLabel.AddParameterPresentCondition(strIdentifier, "\n", False) + ucrInputLabel.AddParameterPresentCondition(strIdentifierAndWeighty, "\n") + ucrInputLabel.AddParameterPresentCondition(strWeight, "weight") + ucrInputLabel.AddParameterPresentCondition(strWeight, "\n", False) + ucrInputLabel.AddParameterPresentCondition(strNone, "identifier", False) + ucrInputLabel.AddParameterPresentCondition(strNone, "weight", False) + ucrInputLabel.SetDropDownStyleAsNonEditable() + + ucrReceiverFill.Selector = ucrSelectorTreemap + ucrReceiverFill.SetParameter(New RParameter("fill", 3)) + ucrReceiverFill.bWithQuotes = False + ucrReceiverFill.SetParameterIsString() + + ucrColourTile.SetParameter(New RParameter("fill", 3)) + ucrColourTile.SetColours() + + ucrColourText.SetParameter(New RParameter("colour", 3)) + ucrColourText.SetColours() + + ucrSaveTreemap.SetIsComboBox() + ucrSaveTreemap.SetCheckBoxText("Save Treemap") + ucrSaveTreemap.SetDataFrameSelector(ucrSelectorTreemap.ucrAvailableDataFrames) + ucrSaveTreemap.SetSaveTypeAsGraph() + ucrSaveTreemap.SetPrefix("treemap") + ucrSaveTreemap.SetAssignToIfUncheckedValue("last_graph") + End Sub + + Private Sub SetDefaults() + clsBaseOperator = New ROperator + clsPipeOperator = New ROperator + clsGroupByFunction = New RFunction + clsSummariseFunction = New RFunction + clsSummaryFunction = New RFunction + clsGgplotFunction = New RFunction + clsGeomTreemapFunction = New RFunction + clsGeomTreemapAesFunction = New RFunction + clsGeomTreemapTextFunction = New RFunction + clsGeomTreemapTextAesFunction = New RFunction + clsPaste0Function = New RFunction + clsDollarFunction = New RFunction + clsLocalAesFunction = New RFunction + clsRCoordPolarParam = New RParameter + clsLabsFunction = New RFunction + clsXlabFunction = New RFunction + clsYlabFunction = New RFunction + clsXScalecontinuousFunction = New RFunction + clsYScalecontinuousFunction = New RFunction + clsRFacetFunction = New RFunction + clsThemeFuction = New RFunction + dctThemeFunctions = New Dictionary(Of String, RFunction) + + bResetSubdialog = True + + ucrSelectorTreemap.Reset() + ucrSelectorTreemap.SetGgplotFunction(clsBaseOperator) + ucrReceiverIdentifier.SetMeAsReceiver() + ucrSaveTreemap.Reset() + + clsPipeOperator.SetOperation("%>%") + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + clsPipeOperator.AddParameter("summarise", clsRFunctionParameter:=clsGroupByFunction, iPosition:=2) + + clsGroupByFunction.SetPackageName("dplyr") + clsGroupByFunction.SetRCommand("group_by") + + clsSummariseFunction.SetPackageName("dplyr") + clsSummariseFunction.SetRCommand("summarise") + clsSummariseFunction.AddParameter(".n", "n()", iPosition:=0) + + clsSummaryFunction.SetRCommand("sum") + clsSummaryFunction.AddParameter("na.rm", "TRUE", iPosition:=1) + + clsBaseOperator.SetOperation("+") + clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsGgplotFunction, iPosition:=0) + clsBaseOperator.AddParameter("geomfunc", clsRFunctionParameter:=clsGeomTreemapFunction, iPosition:=2) + + clsGgplotFunction.SetPackageName("ggplot2") + clsGgplotFunction.SetRCommand("ggplot") + clsGgplotFunction.AddParameter("data", clsROperatorParameter:=clsPipeOperator, iPosition:=0) + clsGgplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsGeomTreemapAesFunction, iPosition:=1) + + clsGeomTreemapAesFunction.SetPackageName("ggplot2") + clsGeomTreemapAesFunction.SetRCommand("aes") + + clsGeomTreemapFunction.SetPackageName("treemapify") + clsGeomTreemapFunction.SetRCommand("geom_treemap") + clsGeomTreemapFunction.AddParameter("fill", Chr(34) & "brown" & Chr(34), iPosition:=2) + + clsGeomTreemapTextFunction.SetPackageName("treemapify") + clsGeomTreemapTextFunction.SetRCommand("geom_treemap_text") + clsGeomTreemapTextFunction.AddParameter("mapping", clsRFunctionParameter:=clsGeomTreemapTextAesFunction, iPosition:=0) + clsGeomTreemapTextFunction.AddParameter("colour", Chr(34) & "white" & Chr(34), iPosition:=2) + + clsGeomTreemapTextAesFunction.SetPackageName("ggplot2") + clsGeomTreemapTextAesFunction.SetRCommand("aes") + clsGeomTreemapTextAesFunction.AddParameter("label", clsRFunctionParameter:=clsPaste0Function, iPosition:=2) + + clsPaste0Function.SetRCommand("paste0") + clsPaste0Function.AddParameter("identifier", ucrReceiverIdentifier.GetVariableNames(), iPosition:=0) + + clsDollarFunction.SetPackageName("scales") + clsDollarFunction.SetRCommand("dollar") + clsDollarFunction.AddParameter("prefix", Chr(34) & "$" & Chr(34), iPosition:=3) + + clsLabsFunction = GgplotDefaults.clsDefaultLabs.Clone() + clsXlabFunction = GgplotDefaults.clsXlabTitleFunction.Clone() + clsYlabFunction = GgplotDefaults.clsYlabTitleFunction.Clone() + clsXScalecontinuousFunction = GgplotDefaults.clsXScalecontinuousFunction.Clone() + clsYScalecontinuousFunction = GgplotDefaults.clsYScalecontinuousFunction.Clone + clsRFacetFunction = GgplotDefaults.clsFacetFunction.Clone() + clsCoordPolarFunction = GgplotDefaults.clsCoordPolarFunction.Clone() + clsCoordPolarStartOperator = GgplotDefaults.clsCoordPolarStartOperator.Clone() + clsBaseOperator.AddParameter(GgplotDefaults.clsDefaultThemeParameter.Clone()) + clsThemeFuction = GgplotDefaults.clsDefaultThemeFunction.Clone + dctThemeFunctions = New Dictionary(Of String, RFunction)(GgplotDefaults.dctThemeFunctions) + clsLocalAesFunction = GgplotDefaults.clsAesFunction.Clone() + + clsBaseOperator.SetAssignTo("last_graph", strTempDataframe:=ucrSelectorTreemap.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") + ucrBase.clsRsyntax.SetBaseROperator(clsBaseOperator) + End Sub + + Private Sub SetRCodeForControls(bReset As Boolean) + bRCodeSet = False + ucrReceiverWeightBy.AddAdditionalCodeParameterPair(clsSummaryFunction, New RParameter("x", iNewPosition:=0, bNewIncludeArgumentName:=False)) + + ucrPnlDataType.SetRCode(clsPipeOperator, bReset) + ucrSelectorTreemap.SetRCode(clsPipeOperator, bReset) + ucrReceiverIdentifier.SetRCode(clsGroupByFunction, bReset) + ucrReceiverWeightBy.SetRCode(clsGeomTreemapAesFunction, bReset) + ucrChkIsCurrency.SetRCode(clsPaste0Function, bReset) + ucrInputSymbol.SetRCode(clsDollarFunction, bReset) + ucrInputLabel.SetRCode(clsPaste0Function, bReset) + ucrReceiverFill.SetRCode(clsGeomTreemapAesFunction, bReset) + ucrColourTile.SetRCode(clsGeomTreemapFunction, bReset) + ucrColourText.SetRCode(clsGeomTreemapTextFunction, bReset) + If bReset Then + ucrInputLabel.SetText(strIdentifier) + End If + bRCodeSet = True + ucrInputSummary.SetName(clsSummaryFunction.strRCommand) + SetLabel() + WeightControls() + SetPipeAssignTo() + PanelSettings() + End Sub + + Private Sub TestOkEnabled() + If rdoPrimary.Checked Then + If Not ucrReceiverIdentifier.IsEmpty() AndAlso ucrSaveTreemap.IsComplete() Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + ElseIf rdoSummary.Checked Then + If Not ucrReceiverWeightBy.IsEmpty() AndAlso ucrSaveTreemap.IsComplete() Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End If + End Sub + + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeForControls(True) + TestOkEnabled() + End Sub + + Private Sub CoreControls_ContentsChanged() Handles ucrReceiverIdentifier.ControlContentsChanged, ucrSaveTreemap.ControlContentsChanged, ucrPnlDataType.ControlContentsChanged, ucrReceiverWeightBy.ControlContentsChanged + TestOkEnabled() + End Sub + + Private Sub ucrPnlDataType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlDataType.ControlValueChanged + PanelSettings() + End Sub + + Private Sub PanelSettings() + If bRCodeSet Then + If rdoPrimary.Checked Then + ' Cannot have facets in Primary data case since columns are not carried. + clsBaseOperator.RemoveParameterByName("facets") + lblIdentifier.Text = "Identifier:" + lblWeightBy.Text = "Weight By (Optional):" + clsPipeOperator.AddParameter("group_by", clsRFunctionParameter:=clsGroupByFunction, iPosition:=1) + clsPipeOperator.AddParameter("summarise", clsRFunctionParameter:=clsSummariseFunction, iPosition:=2) + ElseIf rdoSummary.Checked Then + lblIdentifier.Text = "Identifier (Optional):" + lblWeightBy.Text = "Weight By:" + clsPipeOperator.RemoveParameterByName("group_by") + clsPipeOperator.RemoveParameterByName("summarise") + End If + SetPipeAssignTo() + WeightControls() + End If + End Sub + + Private Sub ucrInputLabel_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLabel.ControlValueChanged + SetLabel() + End Sub + + Private Sub SetLabel() + If bRCodeSet Then + clsPaste0Function.ClearParameters() + Select Case ucrInputLabel.GetText() + Case strIdentifier + clsBaseOperator.AddParameter("geomfunc2", clsRFunctionParameter:=clsGeomTreemapTextFunction, iPosition:=3) + clsGeomTreemapTextAesFunction.AddParameter("label", clsRFunctionParameter:=clsPaste0Function, iPosition:=2) + clsPaste0Function.AddParameter("identifier", ucrReceiverIdentifier.GetVariableNames(False), iPosition:=0, bIncludeArgumentName:=False) + Case strIdentifierAndWeighty, strWeight + clsBaseOperator.AddParameter("geomfunc2", clsRFunctionParameter:=clsGeomTreemapTextFunction, iPosition:=3) + clsGeomTreemapTextAesFunction.AddParameter("label", clsRFunctionParameter:=clsPaste0Function, iPosition:=2) + If ucrInputLabel.GetText() = strIdentifierAndWeighty Then + clsPaste0Function.AddParameter("identifier", ucrReceiverIdentifier.GetVariableNames(False), iPosition:=0, bIncludeArgumentName:=False) + clsPaste0Function.AddParameter("\n", Chr(34) & "\n" & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + End If + If ucrChkIsCurrency.Checked Then + clsPaste0Function.AddParameter("dollar", clsRFunctionParameter:=clsDollarFunction, iPosition:=2, bIncludeArgumentName:=False) + clsDollarFunction.AddParameter("x", ucrReceiverWeightBy.GetVariableNames(False), iPosition:=0) + clsPaste0Function.RemoveParameterByName("weight") + Else + clsPaste0Function.AddParameter("weight", ucrReceiverWeightBy.GetVariableNames(False), iPosition:=2, bIncludeArgumentName:=False) + clsPaste0Function.RemoveParameterByName("dollar") + End If + Case strNone + clsBaseOperator.RemoveParameterByName("geomfunc2") + clsGeomTreemapTextAesFunction.RemoveParameterByName("label") + End Select + End If + End Sub + + Private Sub ucrReceiverFill_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverFill.ControlValueChanged + If ucrReceiverFill.IsEmpty() Then + clsGeomTreemapFunction.AddParameter("fill", ucrColourTile.GetText(), iPosition:=3) + ucrColourTile.Enabled = True + Else + clsGeomTreemapFunction.RemoveParameterByName("fill") + ucrColourTile.Enabled = False + End If + End Sub + + Private Sub ucrReceivers_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverIdentifier.ControlValueChanged, ucrReceiverWeightBy.ControlValueChanged, ucrPnlDataType.ControlValueChanged + If rdoPrimary.Checked Then + If ucrReceiverWeightBy.IsEmpty Then + clsGeomTreemapAesFunction.AddParameter("area", ".n", iPosition:=0) + Else + clsGeomTreemapAesFunction.AddParameter("area", ucrReceiverWeightBy.GetVariableNames(False), iPosition:=0) + End If + ElseIf rdoSummary.Checked Then + clsGeomTreemapAesFunction.AddParameter("area", ucrReceiverWeightBy.GetVariableNames(False), iPosition:=0) + End If + SetLabel() + End Sub + + Private Sub ucrReceiverWeightBy_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverWeightBy.ControlValueChanged + WeightControls() + End Sub + + Private Sub WeightControls() + If bRCodeSet Then + If rdoPrimary.Checked Then + ucrInputSummary.Visible = True + If ucrReceiverWeightBy.IsEmpty Then + ucrChkIsCurrency.Enabled = False + ucrInputSummary.Enabled = False + ucrInputSymbol.Enabled = False + If {strIdentifierAndWeighty, strWeight}.Contains(ucrInputLabel.GetText()) Then + ucrInputLabel.SetName(strIdentifier) + End If + Else + ucrChkIsCurrency.Enabled = True + ucrInputSummary.Enabled = True + ucrInputSymbol.Enabled = True + End If + ElseIf rdoSummary.Checked Then + ucrInputSummary.Visible = False + End If + SetSummary() + End If + End Sub + + Private Sub SetSummary() + If bRCodeSet Then + clsSummariseFunction.ClearParameters() + clsSummariseFunction.AddParameter(".n", "n()", iPosition:=0) + If Not ucrReceiverWeightBy.IsEmpty Then + clsSummariseFunction.AddParameter(ucrReceiverWeightBy.GetVariableNames(False), clsRFunctionParameter:=clsSummaryFunction, iPosition:=1) + End If + End If + End Sub + + Private Sub ucrInputSummary_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputSummary.ControlValueChanged + clsSummaryFunction.SetRCommand(ucrInputSummary.GetText()) + End Sub + + Private Sub ucrSelectorTreemap_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorTreemap.ControlValueChanged + SetPipeAssignTo() + End Sub + + Private Sub SetPipeAssignTo() + If bRCodeSet Then + If rdoPrimary.Checked Then + If ucrSelectorTreemap.ucrAvailableDataFrames.cboAvailableDataFrames.Text <> "" Then + clsPipeOperator.SetAssignTo(ucrSelectorTreemap.ucrAvailableDataFrames.cboAvailableDataFrames.Text & "_summary") + End If + ElseIf rdoSummary.Checked Then + clsPipeOperator.RemoveAssignTo() + End If + End If + End Sub + + Private Sub ucrChkIsCurrency_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkIsCurrency.ControlValueChanged + SetLabel() + End Sub + + Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click + sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewXLabsTitleFunction:=clsXlabFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewThemeFunction:=clsThemeFuction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsGeomTreemapAesFunction, ucrNewBaseSelector:=ucrSelectorTreemap, bReset:=bResetSubdialog) + 'this is a temporary fix + If rdoPrimary.Checked Then + sdgPlots.tbpFacet.Enabled = False + sdgPlots.tbpLayers.Enabled = False + End If + sdgPlots.ShowDialog() + sdgPlots.tbpFacet.Enabled = True + sdgPlots.tbpLayers.Enabled = True + bResetSubdialog = False + End Sub + + Private Sub CoreControls_ContentsChanged(ucrChangedControl As ucrCore) Handles ucrSaveTreemap.ControlContentsChanged, ucrReceiverWeightBy.ControlContentsChanged, ucrReceiverIdentifier.ControlContentsChanged, ucrPnlDataType.ControlContentsChanged + + End Sub +End Class \ No newline at end of file