Skip to content

Commit

Permalink
Merge pull request #172 from Vitalis95/discretenew
Browse files Browse the repository at this point in the history
Discretenew
  • Loading branch information
Vitalis95 authored Sep 26, 2023
2 parents be9898b + b3d9615 commit c30d72e
Show file tree
Hide file tree
Showing 7 changed files with 842 additions and 62 deletions.
35 changes: 32 additions & 3 deletions instat/clsGgplotDefaults.vb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ Public Class GgplotDefaults
End Get
End Property

Public Shared ReadOnly Property clsXScaleDiscreteFunction As RFunction
Get
Dim clsXlabScalesTempFunc As New RFunction

clsXlabScalesTempFunc.SetPackageName("ggplot2")

clsXlabScalesTempFunc.SetRCommand("scale_x_discrete")
Return clsXlabScalesTempFunc
End Get
End Property

Public Shared ReadOnly Property clsYScalecontinuousFunction As RFunction
Get
Dim clsYlabScalesTempFunc As New RFunction
Expand All @@ -115,6 +126,17 @@ Public Class GgplotDefaults
End Get
End Property

Public Shared ReadOnly Property clsYScaleDiscreteFunction As RFunction
Get
Dim clsYlabScalesTempFunc As New RFunction

clsYlabScalesTempFunc.SetPackageName("ggplot2")
clsYlabScalesTempFunc.SetRCommand("scale_y_discrete")

Return clsYlabScalesTempFunc
End Get
End Property

Public Shared ReadOnly Property clsXScaleDateFunction As RFunction
Get
Dim clsXScaleDateFunctionTemp As New RFunction
Expand Down Expand Up @@ -222,7 +244,6 @@ Public Class GgplotDefaults
dctTemp.Add("caption", clsElementText.Clone())
dctTemp.Add("tag", clsElementText.Clone())
dctTemp.Add("colour", clsElementText.Clone())

'dctTemp.Add("aspect.ratio", clsElementText.Clone())
dctTemp.Add("axis.title", clsElementText.Clone())
dctTemp.Add("axis.title.x", clsElementText.Clone())
Expand Down Expand Up @@ -275,7 +296,6 @@ Public Class GgplotDefaults
dctTemp.Add("plot.title", clsElementText.Clone())
dctTemp.Add("plot.subtitle", clsElementText.Clone())
dctTemp.Add("plot.caption", clsElementText.Clone())
dctTemp.Add("plot.tag", clsElementText.Clone())
dctTemp.Add("plot.margin", clsUnit.Clone())
dctTemp.Add("strip.background", clsElementRect.Clone())
' dctTemp.Add("strip.placement", clsElementLine.Clone())
Expand Down Expand Up @@ -427,6 +447,14 @@ Public Class GgplotDefaults
End Get
End Property

Public Shared ReadOnly Property dctDropUnusedLevels As Dictionary(Of String, String)
Get
Dim dctTempDropUnusedLevels As New Dictionary(Of String, String)
dctTempDropUnusedLevels.Add("TRUE", Chr(34) & "TRUE" & Chr(34))
dctTempDropUnusedLevels.Add("FALSE", Chr(34) & "FALSE" & Chr(34))
Return dctTempDropUnusedLevels
End Get
End Property

Public Shared ReadOnly Property dctXPosition As Dictionary(Of String, String)
Get
Expand Down Expand Up @@ -466,4 +494,5 @@ Public Class GgplotDefaults
Return dctDateStartMonths
End Get
End Property
End Class
End Class

12 changes: 10 additions & 2 deletions instat/dlgBarAndPieChart.vb
Original file line number Diff line number Diff line change
Expand Up @@ -717,13 +717,21 @@ Public Class dlgBarAndPieChart
End Sub

Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click, toolStripMenuItemPlotOptions.Click
sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction,
Dim clsTempGlobalAesFunction As New RFunction
If rdoValue.Checked OrElse rdoFrequency.Checked Then
clsTempGlobalAesFunction = clsBarAesFunction
If ucrChkPolarCoordinates.Checked Then
clsTempGlobalAesFunction = clsPieAesFunction
End If
End If
sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction,
clsNewXLabsTitleFunction:=clsXlabFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction,
clsNewThemeFunction:=clsThemeFuction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsTempGlobalAesFunction, ucrNewBaseSelector:=ucrBarChartSelector,
clsNewThemeFunction:=clsThemeFuction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsTextAesFunction, ucrNewBaseSelector:=ucrBarChartSelector,
clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewAnnotateFunction:=clsAnnotateFunction,
clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction,
strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog)
sdgPlots.ShowDialog()
sdgPlots.ShowDialog()
bResetSubdialog = False
End Sub

Expand Down
12 changes: 10 additions & 2 deletions instat/dlgGeneralForGraphics.vb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Public Class dlgGeneralForGraphics
Private clsScaleFillViridisFunction As New RFunction
Private clsScaleColourViridisFunction As New RFunction
Private clsAnnotateFunction As New RFunction
Private clsYScaleDiscreteFunction As New RFunction
Private clsXScaleDiscreteFunction As New RFunction
Private clsDummyFunction As New RFunction

Private Sub dlgGeneralForGraphics_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Expand Down Expand Up @@ -123,6 +125,7 @@ Public Class dlgGeneralForGraphics
ucrVariablesAsFactorForGraphics.SetMeAsReceiver()
bDataFrameSet = False
bResetOptionsSubdialog = True
bResetSubdialog = True

clsDummyFunction.AddParameter("group", "false", iPosition:=0)

Expand Down Expand Up @@ -151,6 +154,8 @@ Public Class dlgGeneralForGraphics
clsLabsFunction = GgplotDefaults.clsDefaultLabs.Clone()
clsXScalecontinuousFunction = GgplotDefaults.clsXScalecontinuousFunction.Clone()
clsYScalecontinuousFunction = GgplotDefaults.clsYScalecontinuousFunction.Clone()
clsYScaleDiscreteFunction = GgplotDefaults.clsYScaleDiscreteFunction.Clone
clsXScaleDiscreteFunction = GgplotDefaults.clsXScaleDiscreteFunction.Clone
clsFacetsFunction = GgplotDefaults.clsFacetFunction.Clone()
clsCoordPolarStartOperator = GgplotDefaults.clsCoordPolarStartOperator.Clone()
clsCoordPolarFunction = GgplotDefaults.clsCoordPolarFunction.Clone()
Expand Down Expand Up @@ -209,6 +214,7 @@ Public Class dlgGeneralForGraphics
sdgPlots.ShowDialog()
bResetOptionsSubdialog = False
sdgPlots.EnableLayersTab()
bResetSubdialog = False
End Sub

Private Sub ucrAdditionalLayers_NumberOfLayersChanged() Handles ucrAdditionalLayers.NumberOfLayersChanged
Expand All @@ -221,27 +227,29 @@ Public Class dlgGeneralForGraphics
sdgPlots.DisableLayersTab()
sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction,
clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewLabsFunction:=clsLabsFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabsFunction,
clsNewFacetFunction:=clsFacetsFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction,
clsNewFacetFunction:=clsFacetsFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewGlobalAesFunction:=clsGlobalAesFunction,
clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, ucrNewBaseSelector:=sdgLayerOptions.ucrGeomWithAes.ucrGeomWithAesSelector, clsNewAnnotateFunction:=clsAnnotateFunction,
clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, bReset:=bResetSubdialog)
sdgPlots.tbpPlotsOptions.SelectedIndex = 0
sdgPlots.ShowDialog()
bResetOptionsSubdialog = False
sdgPlots.EnableLayersTab()
bResetSubdialog = False
End Sub

Private Sub cmdTheme_Click(sender As Object, e As EventArgs) Handles cmdTheme.Click
sdgPlots.DisableLayersTab()
sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction,
clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, clsNewLabsFunction:=clsLabsFunction, clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabsFunction,
clsNewFacetFunction:=clsFacetsFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction,
clsNewFacetFunction:=clsFacetsFunction, clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewGlobalAesFunction:=clsGlobalAesFunction,
clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction, ucrNewBaseSelector:=sdgLayerOptions.ucrGeomWithAes.ucrGeomWithAesSelector, clsNewAnnotateFunction:=clsAnnotateFunction,
clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, bReset:=bResetSubdialog)
sdgPlots.tbpPlotsOptions.SelectedIndex = 5
sdgPlots.ShowDialog()
sdgPlots.tbpPlotsOptions.SelectedIndex = 0
bResetOptionsSubdialog = False
sdgPlots.EnableLayersTab()
bResetSubdialog = False
End Sub

Private Sub ucrVariablesAsFactorForGraphics_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrVariablesAsFactorForGraphics.ControlValueChanged, ucrFillOrColourReceiver.ControlValueChanged
Expand Down
5 changes: 3 additions & 2 deletions instat/dlgLinePlot.vb
Original file line number Diff line number Diff line change
Expand Up @@ -822,8 +822,8 @@ Public Class dlgLinePlot
sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction,
clsNewXLabsTitleFunction:=clsXlabsFunction, clsNewYLabTitleFunction:=clsYlabFunction, clsNewLabsFunction:=clsLabsFunction, clsNewFacetFunction:=clsRFacetFunction,
clsNewThemeFunction:=clsThemeFunction, dctNewThemeFunctions:=dctThemeFunctions, clsNewGlobalAesFunction:=clsRaesFunction, ucrNewBaseSelector:=ucrLinePlotSelector,
clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewAnnotateFunction:=clsAnnotateFunction,
clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction,
clsNewCoordPolarFunction:=clsCoordPolarFunction, clsNewCoordPolarStartOperator:=clsCoordPolarStartOperator, clsNewXScaleDateFunction:=clsXScaleDateFunction, clsNewAnnotateFunction:=clsAnnotateFunction,
clsNewScaleFillViridisFunction:=clsScaleFillViridisFunction, clsNewScaleColourViridisFunction:=clsScaleColourViridisFunction, clsNewYScaleDateFunction:=clsYScaleDateFunction,
strMainDialogGeomParameterNames:=strGeomParameterNames, bReset:=bResetSubdialog)
sdgPlots.ShowDialog()
bResetSubdialog = False
Expand Down Expand Up @@ -876,4 +876,5 @@ Public Class dlgLinePlot
Private Sub RibbonOptionsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RibbonOptionsToolStripMenuItem.Click
openSdgLayerOptions(clsGeomRibbonFunction)
End Sub

End Class
Loading

0 comments on commit c30d72e

Please sign in to comment.