diff --git a/instat/dlgBarAndPieChart.Designer.vb b/instat/dlgBarAndPieChart.Designer.vb index 0c9bd164f82..e09a47561ae 100644 --- a/instat/dlgBarAndPieChart.Designer.vb +++ b/instat/dlgBarAndPieChart.Designer.vb @@ -39,35 +39,27 @@ Partial Class dlgBarAndPieChart Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(dlgBarAndPieChart)) - Me.lblVariable = New System.Windows.Forms.Label() Me.lblByFactor = New System.Windows.Forms.Label() Me.cmdOptions = New System.Windows.Forms.Button() Me.cmdPieChartOptions = New System.Windows.Forms.Button() Me.rdoPieChart = New System.Windows.Forms.RadioButton() - Me.rdoBarChart = New System.Windows.Forms.RadioButton() + Me.rdoValue = New System.Windows.Forms.RadioButton() Me.cmdBarChartOptions = New System.Windows.Forms.Button() Me.lblPosition = New System.Windows.Forms.Label() - Me.lblYvariable = New System.Windows.Forms.Label() Me.cmdColumnChartOptions = New System.Windows.Forms.Button() - Me.lblYValue = New System.Windows.Forms.Label() - Me.ucrInputYValue = New instat.ucrInputComboBox() - Me.ucrReceiverY = New instat.ucrReceiverSingle() - Me.ucrInputBarChartPosition = New instat.ucrInputComboBox() + Me.ucrInputBarChartPositions = New instat.ucrInputComboBox() Me.ucrSaveBar = New instat.ucrSave() Me.ucrChkFlipCoordinates = New instat.ucrCheck() Me.ucrReceiverByFactor = New instat.ucrReceiverSingle() - Me.ucrReceiverFirst = New instat.ucrReceiverSingle() Me.ucrBarChartSelector = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlOptions = New instat.UcrPanel() + Me.rdoFrequency = New System.Windows.Forms.RadioButton() + Me.ucrVariablesAsFactorForBarChart = New instat.ucrVariablesAsFactor() + Me.lblXvariable = New System.Windows.Forms.Label() + Me.ucrReceiverX = New instat.ucrReceiverSingle() Me.SuspendLayout() ' - 'lblVariable - ' - resources.ApplyResources(Me.lblVariable, "lblVariable") - Me.lblVariable.Name = "lblVariable" - Me.lblVariable.Tag = "Variable:" - ' 'lblByFactor ' resources.ApplyResources(Me.lblByFactor, "lblByFactor") @@ -100,17 +92,17 @@ Partial Class dlgBarAndPieChart Me.rdoPieChart.Tag = "Pie_Chart" Me.rdoPieChart.UseVisualStyleBackColor = False ' - 'rdoBarChart + 'rdoValue ' - resources.ApplyResources(Me.rdoBarChart, "rdoBarChart") - Me.rdoBarChart.BackColor = System.Drawing.SystemColors.Control - Me.rdoBarChart.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption - Me.rdoBarChart.FlatAppearance.BorderSize = 2 - Me.rdoBarChart.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption - Me.rdoBarChart.Name = "rdoBarChart" - Me.rdoBarChart.TabStop = True - Me.rdoBarChart.Tag = "Bar_Chart" - Me.rdoBarChart.UseVisualStyleBackColor = False + resources.ApplyResources(Me.rdoValue, "rdoValue") + Me.rdoValue.BackColor = System.Drawing.SystemColors.Control + Me.rdoValue.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoValue.FlatAppearance.BorderSize = 2 + Me.rdoValue.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoValue.Name = "rdoValue" + Me.rdoValue.TabStop = True + Me.rdoValue.Tag = "Value" + Me.rdoValue.UseVisualStyleBackColor = False ' 'cmdBarChartOptions ' @@ -124,11 +116,6 @@ Partial Class dlgBarAndPieChart resources.ApplyResources(Me.lblPosition, "lblPosition") Me.lblPosition.Name = "lblPosition" ' - 'lblYvariable - ' - resources.ApplyResources(Me.lblYvariable, "lblYvariable") - Me.lblYvariable.Name = "lblYvariable" - ' 'cmdColumnChartOptions ' resources.ApplyResources(Me.cmdColumnChartOptions, "cmdColumnChartOptions") @@ -136,33 +123,13 @@ Partial Class dlgBarAndPieChart Me.cmdColumnChartOptions.Tag = "Column_Chart_Options" Me.cmdColumnChartOptions.UseVisualStyleBackColor = True ' - 'lblYValue - ' - resources.ApplyResources(Me.lblYValue, "lblYValue") - Me.lblYValue.Name = "lblYValue" - ' - 'ucrInputYValue - ' - Me.ucrInputYValue.AddQuotesIfUnrecognised = True - Me.ucrInputYValue.IsReadOnly = False - resources.ApplyResources(Me.ucrInputYValue, "ucrInputYValue") - Me.ucrInputYValue.Name = "ucrInputYValue" - ' - 'ucrReceiverY - ' - Me.ucrReceiverY.frmParent = Me - resources.ApplyResources(Me.ucrReceiverY, "ucrReceiverY") - Me.ucrReceiverY.Name = "ucrReceiverY" - Me.ucrReceiverY.Selector = Nothing - Me.ucrReceiverY.strNcFilePath = "" - Me.ucrReceiverY.ucrSelector = Nothing - ' - 'ucrInputBarChartPosition + 'ucrInputBarChartPositions ' - Me.ucrInputBarChartPosition.AddQuotesIfUnrecognised = True - Me.ucrInputBarChartPosition.IsReadOnly = False - resources.ApplyResources(Me.ucrInputBarChartPosition, "ucrInputBarChartPosition") - Me.ucrInputBarChartPosition.Name = "ucrInputBarChartPosition" + Me.ucrInputBarChartPositions.AddQuotesIfUnrecognised = True + Me.ucrInputBarChartPositions.GetSetSelectedIndex = -1 + Me.ucrInputBarChartPositions.IsReadOnly = False + resources.ApplyResources(Me.ucrInputBarChartPositions, "ucrInputBarChartPositions") + Me.ucrInputBarChartPositions.Name = "ucrInputBarChartPositions" ' 'ucrSaveBar ' @@ -184,15 +151,6 @@ Partial Class dlgBarAndPieChart Me.ucrReceiverByFactor.strNcFilePath = "" Me.ucrReceiverByFactor.ucrSelector = Nothing ' - 'ucrReceiverFirst - ' - Me.ucrReceiverFirst.frmParent = Me - resources.ApplyResources(Me.ucrReceiverFirst, "ucrReceiverFirst") - Me.ucrReceiverFirst.Name = "ucrReceiverFirst" - Me.ucrReceiverFirst.Selector = Nothing - Me.ucrReceiverFirst.strNcFilePath = "" - Me.ucrReceiverFirst.ucrSelector = Nothing - ' 'ucrBarChartSelector ' Me.ucrBarChartSelector.bDropUnusedFilterLevels = False @@ -211,26 +169,60 @@ Partial Class dlgBarAndPieChart resources.ApplyResources(Me.ucrPnlOptions, "ucrPnlOptions") Me.ucrPnlOptions.Name = "ucrPnlOptions" ' + 'rdoFrequency + ' + resources.ApplyResources(Me.rdoFrequency, "rdoFrequency") + Me.rdoFrequency.BackColor = System.Drawing.SystemColors.Control + Me.rdoFrequency.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFrequency.FlatAppearance.BorderSize = 2 + Me.rdoFrequency.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoFrequency.Name = "rdoFrequency" + Me.rdoFrequency.TabStop = True + Me.rdoFrequency.Tag = "Frequency" + Me.rdoFrequency.UseVisualStyleBackColor = False + ' + 'ucrVariablesAsFactorForBarChart + ' + Me.ucrVariablesAsFactorForBarChart.frmParent = Me + resources.ApplyResources(Me.ucrVariablesAsFactorForBarChart, "ucrVariablesAsFactorForBarChart") + Me.ucrVariablesAsFactorForBarChart.Name = "ucrVariablesAsFactorForBarChart" + Me.ucrVariablesAsFactorForBarChart.Selector = Nothing + Me.ucrVariablesAsFactorForBarChart.strNcFilePath = "" + Me.ucrVariablesAsFactorForBarChart.ucrSelector = Nothing + Me.ucrVariablesAsFactorForBarChart.ucrVariableSelector = Nothing + ' + 'lblXvariable + ' + resources.ApplyResources(Me.lblXvariable, "lblXvariable") + Me.lblXvariable.Name = "lblXvariable" + ' + 'ucrReceiverX + ' + Me.ucrReceiverX.frmParent = Me + resources.ApplyResources(Me.ucrReceiverX, "ucrReceiverX") + Me.ucrReceiverX.Name = "ucrReceiverX" + Me.ucrReceiverX.Selector = Nothing + Me.ucrReceiverX.strNcFilePath = "" + Me.ucrReceiverX.ucrSelector = Nothing + ' 'dlgBarAndPieChart ' resources.ApplyResources(Me, "$this") Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.Controls.Add(Me.ucrInputYValue) - Me.Controls.Add(Me.lblYValue) + Me.Controls.Add(Me.lblXvariable) + Me.Controls.Add(Me.ucrReceiverX) + Me.Controls.Add(Me.ucrVariablesAsFactorForBarChart) + Me.Controls.Add(Me.rdoFrequency) + Me.Controls.Add(Me.ucrInputBarChartPositions) Me.Controls.Add(Me.cmdColumnChartOptions) - Me.Controls.Add(Me.lblYvariable) - Me.Controls.Add(Me.ucrReceiverY) Me.Controls.Add(Me.lblPosition) - Me.Controls.Add(Me.ucrInputBarChartPosition) Me.Controls.Add(Me.ucrSaveBar) Me.Controls.Add(Me.ucrChkFlipCoordinates) - Me.Controls.Add(Me.rdoBarChart) + Me.Controls.Add(Me.rdoValue) Me.Controls.Add(Me.rdoPieChart) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.lblByFactor) - Me.Controls.Add(Me.lblVariable) Me.Controls.Add(Me.ucrReceiverByFactor) - Me.Controls.Add(Me.ucrReceiverFirst) Me.Controls.Add(Me.ucrBarChartSelector) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.cmdBarChartOptions) @@ -248,23 +240,21 @@ Partial Class dlgBarAndPieChart Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrBarChartSelector As ucrSelectorByDataFrameAddRemove - Friend WithEvents ucrReceiverFirst As ucrReceiverSingle Friend WithEvents ucrReceiverByFactor As ucrReceiverSingle - Friend WithEvents lblVariable As Label Friend WithEvents lblByFactor As Label Friend WithEvents cmdOptions As Button Friend WithEvents cmdPieChartOptions As Button Friend WithEvents ucrSaveBar As ucrSave Friend WithEvents ucrChkFlipCoordinates As ucrCheck - Friend WithEvents rdoBarChart As RadioButton + Friend WithEvents rdoValue As RadioButton Friend WithEvents rdoPieChart As RadioButton Friend WithEvents ucrPnlOptions As UcrPanel Friend WithEvents cmdBarChartOptions As Button - Friend WithEvents ucrInputBarChartPosition As ucrInputComboBox Friend WithEvents lblPosition As Label - Friend WithEvents lblYvariable As Label - Friend WithEvents ucrReceiverY As ucrReceiverSingle Friend WithEvents cmdColumnChartOptions As Button - Friend WithEvents ucrInputYValue As ucrInputComboBox - Friend WithEvents lblYValue As Label + Friend WithEvents ucrInputBarChartPositions As ucrInputComboBox + Friend WithEvents rdoFrequency As RadioButton + Friend WithEvents ucrVariablesAsFactorForBarChart As ucrVariablesAsFactor + Friend WithEvents lblXvariable As Label + Friend WithEvents ucrReceiverX As ucrReceiverSingle End Class \ No newline at end of file diff --git a/instat/dlgBarAndPieChart.resx b/instat/dlgBarAndPieChart.resx index 0f51d997429..c087f77da4b 100644 --- a/instat/dlgBarAndPieChart.resx +++ b/instat/dlgBarAndPieChart.resx @@ -118,52 +118,22 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - - NoControl - - - - 252, 76 - - - 58, 13 - - - 5 - - - X Variable: - - - lblVariable - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 13 - True + NoControl + - 252, 226 + 252, 255 103, 13 - 7 + 8 By Factor (Optional): @@ -232,11 +202,14 @@ $this - 19 + 17 Button + + False + Flat @@ -244,13 +217,13 @@ NoControl - 206, 12 + 264, 12 110, 28 - 2 + 3 Pie Chart @@ -270,40 +243,40 @@ 10 - + Button - + Flat - + NoControl - - 98, 12 + + 156, 12 - + 110, 28 - - 1 + + 2 - - Bar Chart + + Value - + MiddleCenter - - rdoBarChart + + rdoValue - + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 9 @@ -331,7 +304,7 @@ $this - 18 + 16 True @@ -340,13 +313,13 @@ NoControl - 252, 176 + 252, 297 47, 13 - 8 + 10 Position: @@ -361,37 +334,7 @@ $this - 5 - - - True - - - NoControl - - - 252, 176 - - - 58, 13 - - - 9 - - - Y Variable: - - - lblYvariable - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 + 6 NoControl @@ -418,91 +361,28 @@ $this - 2 - - - True - - - NoControl - - - 252, 126 - - - 47, 13 - - - 19 - - - Y Value: - - - lblYValue - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 1 - - - 255, 142 - - - 107, 21 - - - 20 - - - ucrInputYValue - - - instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - - - $this - - - 0 - - - True - - - 6, 13 - - - 415, 411 - - - 255, 190 + 5 - - 21, 17, 21, 17 + + 252, 313 - - 92, 21 + + 120, 21 - - 10 + + 11 - - ucrInputBarChartPosition + + ucrInputBarChartPositions - + instat.ucrInputComboBox, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 6 + + 4 9, 328 @@ -549,53 +429,125 @@ 8 - - 255, 239 + + True + + + 6, 13 - - 0, 0, 0, 0 + + 415, 411 - - 120, 20 + + True - - 8 + + NoControl - - ucrReceiverByFactor + + 252, 212 - - instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + 58, 13 - + + 6 + + + X Variable: + + + lblXvariable + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + $this - - 14 + + 0 - - 255, 89 + + 252, 226 - + 0, 0, 0, 0 - - 120, 20 + + 120, 21 - - 6 + + 7 - - ucrReceiverFirst + + ucrReceiverX - + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 15 + + 1 + + + 252, 62 + + + 125, 136 + + + 5 + + + ucrVariablesAsFactorForBarChart + + + instat.ucrVariablesAsFactor, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 2 + + + Button + + + Flat + + + NoControl + + + 48, 12 + + + 110, 28 + + + 1 + + + Frequency + + + MiddleCenter + + + rdoFrequency + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 10, 41 @@ -619,7 +571,7 @@ $this - 16 + 14 9, 358 @@ -640,10 +592,10 @@ $this - 17 + 15 - 66, 6 + 47, 6 330, 36 @@ -661,7 +613,7 @@ $this - 20 + 18 CenterScreen @@ -675,28 +627,28 @@ System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 255, 190 + + 252, 270 - + 0, 0, 0, 0 - - 120, 21 + + 120, 20 - - 11 + + 9 - - ucrReceiverY + + ucrReceiverByFactor - + instat.ucrReceiverSingle, instat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - + $this - - 4 + + 13 \ No newline at end of file diff --git a/instat/dlgBarAndPieChart.vb b/instat/dlgBarAndPieChart.vb index 42aff1719c7..a2fab5c985d 100644 --- a/instat/dlgBarAndPieChart.vb +++ b/instat/dlgBarAndPieChart.vb @@ -55,9 +55,8 @@ Public Class dlgBarAndPieChart SetRCodeForControls(bReset) bReset = False - ChangeLabel() - autoTranslate(Me) TestOkEnabled() + autoTranslate(Me) End Sub Private Sub InitialiseDialog() @@ -71,26 +70,32 @@ Public Class dlgBarAndPieChart ucrBase.clsRsyntax.iCallType = 3 ucrBase.iHelpTopicID = 438 - ucrPnlOptions.AddRadioButton(rdoBarChart) + ucrPnlOptions.AddRadioButton(rdoFrequency) + ucrPnlOptions.AddRadioButton(rdoValue) ucrPnlOptions.AddRadioButton(rdoPieChart) - ucrPnlOptions.AddParameterPresentCondition(rdoPieChart, "coordpolar") - ucrPnlOptions.AddParameterPresentCondition(rdoBarChart, "coordpolar", False) + ucrPnlOptions.AddFunctionNamesCondition(rdoFrequency, "coordpolar") + ucrPnlOptions.AddFunctionNamesCondition(rdoValue, "coordpolar") + ucrPnlOptions.AddFunctionNamesCondition(rdoPieChart, "coordpolar") - ucrPnlOptions.AddToLinkedControls({ucrChkFlipCoordinates}, {rdoBarChart}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrPnlOptions.AddToLinkedControls(ucrInputBarChartPosition, {rdoBarChart}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrInputBarChartPosition.SetLinkedDisplayControl(lblPosition) - ucrPnlOptions.AddToLinkedControls({ucrReceiverByFactor}, {rdoBarChart}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls({ucrChkFlipCoordinates, ucrInputBarChartPositions, ucrReceiverByFactor}, {rdoFrequency, rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlOptions.AddToLinkedControls(ucrReceiverX, {rdoValue}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrReceiverByFactor.SetLinkedDisplayControl(lblByFactor) + ucrReceiverX.SetLinkedDisplayControl(lblXvariable) + ucrInputBarChartPositions.SetLinkedDisplayControl(lblPosition) ucrBarChartSelector.SetParameter(New RParameter("data", 0)) ucrBarChartSelector.SetParameterIsrfunction() - ucrReceiverFirst.Selector = ucrBarChartSelector - ucrReceiverFirst.strSelectorHeading = "Variables" - ucrReceiverFirst.SetParameter(New RParameter("x", 0)) - ucrReceiverFirst.bWithQuotes = False - ucrReceiverFirst.SetParameterIsString() - ucrReceiverFirst.SetLinkedDisplayControl(lblVariable) + ucrVariablesAsFactorForBarChart.SetParameterIsString() + ucrVariablesAsFactorForBarChart.Selector = ucrBarChartSelector + ucrVariablesAsFactorForBarChart.SetFactorReceiver(ucrReceiverByFactor) + ucrVariablesAsFactorForBarChart.strSelectorHeading = "Variables" + ucrVariablesAsFactorForBarChart.SetValuesToIgnore({Chr(34) & Chr(34)}) + ucrVariablesAsFactorForBarChart.bAddParameterIfEmpty = True + + ucrReceiverX.Selector = ucrBarChartSelector + ucrReceiverX.strSelectorHeading = "X Variable" + ucrReceiverX.SetParameterIsString() ucrReceiverByFactor.Selector = ucrBarChartSelector ucrReceiverByFactor.SetIncludedDataTypes({"factor"}) @@ -99,13 +104,6 @@ Public Class dlgBarAndPieChart ucrReceiverByFactor.bWithQuotes = False ucrReceiverByFactor.SetParameterIsString() - ucrReceiverY.Selector = ucrBarChartSelector - ucrReceiverY.strSelectorHeading = "Y Variable" - ucrReceiverY.SetParameter(New RParameter("y", 1)) - ucrReceiverY.bWithQuotes = False - ucrReceiverY.SetParameterIsString() - ucrReceiverY.SetLinkedDisplayControl(lblYvariable) - ucrSaveBar.SetIsComboBox() ucrSaveBar.SetCheckBoxText("Save Graph") ucrSaveBar.SetDataFrameSelector(ucrBarChartSelector.ucrAvailableDataFrames) @@ -126,23 +124,17 @@ Public Class dlgBarAndPieChart ucrChkFlipCoordinates.SetText("Flip Coordinates") ucrChkFlipCoordinates.SetParameter(clsCoordFlipParam, bNewChangeParameterValue:=False, bNewAddRemoveParameter:=True) - ucrInputYValue.SetParameter(New RParameter("stat", 0)) - dctStatOptions.Add("Count", Chr(34) & "count" & Chr(34)) - dctStatOptions.Add("Variable", Chr(34) & "identity" & Chr(34)) - ucrInputYValue.SetItems(dctStatOptions) - ucrInputYValue.SetDropDownStyleAsNonEditable() - ucrInputYValue.SetRDefault(Chr(34) & "count" & Chr(34)) - ucrInputBarChartPosition.SetParameter(New RParameter("position", 0)) + ucrInputBarChartPositions.SetParameter(New RParameter("position", 0)) dctPositionPairs.Add("Stack", Chr(34) & "stack" & Chr(34)) dctPositionPairs.Add("Dodge", Chr(34) & "dodge" & Chr(34)) dctPositionPairs.Add("Identity", Chr(34) & "identity" & Chr(34)) dctPositionPairs.Add("Jitter", Chr(34) & "jitter" & Chr(34)) dctPositionPairs.Add("Fill", Chr(34) & "fill" & Chr(34)) dctPositionPairs.Add("Stack in reverse", "position_stack(reverse = TRUE)") - ucrInputBarChartPosition.SetItems(dctPositionPairs) - ucrInputBarChartPosition.SetDropDownStyleAsNonEditable() - ucrInputBarChartPosition.SetRDefault(Chr(34) & "stack" & Chr(34)) + ucrInputBarChartPositions.SetItems(dctPositionPairs) + ucrInputBarChartPositions.SetDropDownStyleAsNonEditable() + ucrInputBarChartPositions.SetRDefault(Chr(34) & "stack" & Chr(34)) End Sub @@ -155,7 +147,7 @@ Public Class dlgBarAndPieChart ucrBarChartSelector.Reset() ucrBarChartSelector.SetGgplotFunction(clsBaseOperator) - ucrReceiverFirst.SetMeAsReceiver() + ucrVariablesAsFactorForBarChart.SetMeAsReceiver() ucrSaveBar.Reset() bResetSubdialog = True bResetBarLayerSubdialog = True @@ -205,28 +197,24 @@ Public Class dlgBarAndPieChart End Sub Private Sub SetRCodeForControls(bReset As Boolean) - ucrReceiverFirst.SetRCode(clsBarAesFunction, bReset) - ucrReceiverFirst.AddAdditionalCodeParameterPair(clsPieAesFunction, New RParameter("fill", 0), iAdditionalPairNo:=1) - ucrReceiverY.SetRCode(clsBarAesFunction, bReset) - ucrReceiverY.AddAdditionalCodeParameterPair(clsPieAesFunction, New RParameter("y", 1), iAdditionalPairNo:=1) + ucrVariablesAsFactorForBarChart.SetRCode(clsBarAesFunction, bReset) + ucrReceiverX.SetRCode(clsBarAesFunction, bReset) ucrReceiverByFactor.SetRCode(clsBarAesFunction, bReset) ucrSaveBar.SetRCode(clsBaseOperator, bReset) ucrBarChartSelector.SetRCode(clsRggplotFunction, bReset) - ucrPnlOptions.SetRCode(clsBaseOperator, bReset) ucrChkFlipCoordinates.SetRCode(clsBaseOperator, bReset) - ucrInputBarChartPosition.SetRCode(clsRgeomBarFunction, bReset) - ucrInputYValue.SetRCode(clsRgeomBarFunction, bReset) + ucrInputBarChartPositions.SetRCode(clsRgeomBarFunction, bReset) End Sub Private Sub TestOkEnabled() - If rdoBarChart.Checked Then - If Not ucrReceiverFirst.IsEmpty AndAlso Not (ucrReceiverY.IsEmpty AndAlso ucrReceiverY.Visible) AndAlso ucrSaveBar.IsComplete Then - ucrBase.OKEnabled(True) - Else + If rdoFrequency.Checked Then + If Not ucrSaveBar.IsComplete OrElse ucrVariablesAsFactorForBarChart.IsEmpty Then ucrBase.OKEnabled(False) + Else + ucrBase.OKEnabled(True) End If - ElseIf rdoPieChart.Checked Then - If ucrReceiverFirst.IsEmpty OrElse Not ucrSaveBar.IsComplete Then + ElseIf rdoValue.Checked Then + If Not ucrSaveBar.IsComplete OrElse ucrVariablesAsFactorForBarChart.IsEmpty OrElse ucrReceiverX.IsEmpty Then ucrBase.OKEnabled(False) Else ucrBase.OKEnabled(True) @@ -241,7 +229,7 @@ Public Class dlgBarAndPieChart End Sub Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click - If rdoBarChart.Checked Then + If rdoValue.Checked Or rdoFrequency.Checked Then sdgPlots.SetRCode(clsNewOperator:=clsBaseOperator, clsNewGlobalAesFunction:=clsBarAesFunction, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewThemeFunction:=clsThemeFuction, dctNewThemeFunctions:=dctThemeFunctions, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewXLabsTitleFunction:=clsXlabFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction, ucrNewBaseSelector:=ucrBarChartSelector, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, bReset:=bResetSubdialog, bNewEnableDiscrete:=False) Else sdgPlots.SetRCode(clsNewOperator:=clsBaseOperator, clsNewGlobalAesFunction:=clsPieAesFunction, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewThemeFunction:=clsThemeFuction, dctNewThemeFunctions:=dctThemeFunctions, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewXLabsTitleFunction:=clsXlabFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewFacetFunction:=clsRFacetFunction, ucrNewBaseSelector:=ucrBarChartSelector, clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, bReset:=bResetSubdialog) @@ -260,9 +248,9 @@ Public Class dlgBarAndPieChart sdgLayerOptions.ShowDialog() bResetBarLayerSubdialog = False If clsBarAesFunction.ContainsParameter("x") Then - ucrReceiverFirst.Add(clsBarAesFunction.GetParameter("x").strArgumentValue) + ucrVariablesAsFactorForBarChart.Add(clsBarAesFunction.GetParameter("x").strArgumentValue) Else - ucrReceiverFirst.Clear() + ucrVariablesAsFactorForBarChart.Clear() End If If clsBarAesFunction.ContainsParameter("fill") Then ucrReceiverByFactor.Add(clsBarAesFunction.GetParameter("fill").strArgumentValue) @@ -270,7 +258,7 @@ Public Class dlgBarAndPieChart ucrReceiverByFactor.Clear() End If 'Allows for sync with the layer parameters - ucrInputBarChartPosition.SetRCode(clsRgeomBarFunction, bReset) + ucrInputBarChartPositions.SetRCode(clsRgeomBarFunction, bReset) TestOkEnabled() End Sub @@ -278,20 +266,11 @@ Public Class dlgBarAndPieChart sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsRgeomBarFunction, clsNewGlobalAesFunc:=clsPieAesFunction, clsNewLocalAes:=clsLocalRaesFunction, bFixGeom:=True, ucrNewBaseSelector:=ucrBarChartSelector, bApplyAesGlobally:=True, bReset:=bResetBarLayerSubdialog) sdgLayerOptions.ShowDialog() bResetBarLayerSubdialog = False - 'temp fix - should instead be setting R code of the receivers here - If Not clsPieAesFunction.ContainsParameter("x") Then - clsPieAesFunction.AddParameter("x", Chr(34) & Chr(34)) - End If - If clsPieAesFunction.ContainsParameter("fill") Then - ucrReceiverFirst.Add(clsPieAesFunction.GetParameter("fill").strArgumentValue) - Else - ucrReceiverFirst.Clear() - End If TestOkEnabled() End Sub Private Sub SetDialogOptions() - If rdoBarChart.Checked Then + If rdoValue.Checked Or rdoFrequency.Checked Then clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsBarAesFunction, iPosition:=1) cmdPieChartOptions.Visible = False cmdBarChartOptions.Visible = True @@ -305,60 +284,29 @@ Public Class dlgBarAndPieChart If Not ucrSaveBar.bUserTyped Then ucrSaveBar.SetPrefix("bar") End If - ucrReceiverFirst.RemoveIncludedMetadataProperty("class") - ucrReceiverFirst.strSelectorHeading = "Variables" - ElseIf rdoPieChart.Checked Then - clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsPieAesFunction, iPosition:=1) - clsRgeomBarFunction.AddParameter("width", "1") - clsBaseOperator.AddParameter(clsRCoordPolarParam) - clsBaseOperator.RemoveParameterByName("geom_col") - ucrReceiverFirst.SetMeAsReceiver() - cmdPieChartOptions.Visible = True - cmdBarChartOptions.Visible = False - cmdColumnChartOptions.Visible = False - If Not ucrSaveBar.bUserTyped Then - ucrSaveBar.SetPrefix("pie") - End If - ucrReceiverFirst.SetIncludedDataTypes({"factor"}) - ucrReceiverFirst.strSelectorHeading = "Factors" - If Not {"factor", "logical"}.Contains(ucrReceiverFirst.strCurrDataType) Then - ucrReceiverFirst.Clear() - End If + ucrVariablesAsFactorForBarChart.RemoveIncludedMetadataProperty("class") + ucrVariablesAsFactorForBarChart.strSelectorHeading = "Variables" End If End Sub - Private Sub ChangeLabel() - lblVariable.Text = If(rdoBarChart.Checked, "X Variable", "Variable") - lblYValue.Text = If(rdoBarChart.Checked, "Y Value", "Value") - lblYvariable.Text = If(rdoBarChart.Checked, "Y Variable", "Value from") - End Sub - - Private Sub ucrPnlOptions_ControlValueChanged() Handles ucrPnlOptions.ControlValueChanged - SetDialogOptions() - ChangeLabel() - setColumnChartOption() - TestOkEnabled() - autoTranslate(Me) - End Sub - - Private Sub setColumnChartOption() - If ucrInputYValue.GetValue = "Variable" Then - ucrReceiverY.SetVisible(True) - ucrReceiverY.SetMeAsReceiver() - ucrReceiverY.AddOrRemoveParameter(True) - Else - ucrReceiverY.SetVisible(False) - ucrReceiverFirst.SetMeAsReceiver() - ucrReceiverY.AddOrRemoveParameter(False) + Private Sub ChangeParameterName() + clsBarAesFunction.RemoveParameterByName("x") + clsBarAesFunction.RemoveParameterByName("y") + If rdoValue.Checked Then + clsBarAesFunction.AddParameter("x", ucrReceiverX.GetVariableNames(False), iPosition:=1) + clsBarAesFunction.AddParameter("y", ucrVariablesAsFactorForBarChart.GetVariableNames(False), iPosition:=2) + clsRgeomBarFunction.AddParameter("stat", Chr(34) & "identity" & Chr(34), iPosition:=1) + ElseIf rdoFrequency.Checked Then + clsBarAesFunction.AddParameter("x", ucrVariablesAsFactorForBarChart.GetVariableNames(False), iPosition:=1) + clsRgeomBarFunction.AddParameter("stat", Chr(34) & "count" & Chr(34), iPosition:=1) End If End Sub - - Private Sub ucrInputYValue_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputYValue.ControlValueChanged - setColumnChartOption() - TestOkEnabled() + Private Sub ucrPnlOptions_ControlValueChanged() Handles ucrPnlOptions.ControlValueChanged, ucrVariablesAsFactorForBarChart.ControlValueChanged, ucrReceiverX.ControlValueChanged + SetDialogOptions() + ChangeParameterName() End Sub - Private Sub CoreControls_ContentsChanged() Handles ucrReceiverFirst.ControlContentsChanged, ucrReceiverY.ControlContentsChanged, ucrSaveBar.ControlContentsChanged + Private Sub CoreControls_ContentsChanged() Handles ucrVariablesAsFactorForBarChart.ControlContentsChanged, ucrSaveBar.ControlContentsChanged, ucrReceiverX.ControlContentsChanged TestOkEnabled() End Sub End Class