Skip to content

Commit

Permalink
Use the simple grid as default instead of detailed (#7759)
Browse files Browse the repository at this point in the history
Updated the grid lines color to very light gray

Fixes #7711
  • Loading branch information
adeas31 committed Aug 12, 2021
1 parent 9250287 commit 756aa34
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions OMCompiler/Compiler/FrontEnd/ModelicaBuiltin.mo
Expand Up @@ -2814,7 +2814,7 @@ function plot "Launches a plot window using OMPlot."
input Boolean externalWindow = false "Opens the plot in a new plot window";
input String fileName = "<default>" "The filename containing the variables. <default> will read the last simulation result";
input String title = "" "This text will be used as the diagram title.";
input String grid = "detailed" "Sets the grid for the plot i.e simple, detailed, none.";
input String grid = "simple" "Sets the grid for the plot i.e simple, detailed, none.";
input Boolean logX = false "Determines whether or not the horizontal axis is logarithmically scaled.";
input Boolean logY = false "Determines whether or not the vertical axis is logarithmically scaled.";
input String xLabel = "time" "This text will be used as the horizontal label in the diagram.";
Expand Down Expand Up @@ -2852,7 +2852,7 @@ function plotAll "Works in the same way as plot(), but does not accept any
input Boolean externalWindow = false "Opens the plot in a new plot window";
input String fileName = "<default>" "The filename containing the variables. <default> will read the last simulation result";
input String title = "" "This text will be used as the diagram title.";
input String grid = "detailed" "Sets the grid for the plot i.e simple, detailed, none.";
input String grid = "simple" "Sets the grid for the plot i.e simple, detailed, none.";
input Boolean logX = false "Determines whether or not the horizontal axis is logarithmically scaled.";
input Boolean logY = false "Determines whether or not the vertical axis is logarithmically scaled.";
input String xLabel = "time" "This text will be used as the horizontal label in the diagram.";
Expand Down Expand Up @@ -2881,7 +2881,7 @@ function plotParametric "Launches a plotParametric window using OMPlot. Returns
input Boolean externalWindow = false "Opens the plot in a new plot window";
input String fileName = "<default>" "The filename containing the variables. <default> will read the last simulation result";
input String title = "" "This text will be used as the diagram title.";
input String grid = "detailed" "Sets the grid for the plot i.e simple, detailed, none.";
input String grid = "simple" "Sets the grid for the plot i.e simple, detailed, none.";
input Boolean logX = false "Determines whether or not the horizontal axis is logarithmically scaled.";
input Boolean logY = false "Determines whether or not the vertical axis is logarithmically scaled.";
input String xLabel = "" "This text will be used as the horizontal label in the diagram.";
Expand Down
6 changes: 3 additions & 3 deletions OMCompiler/Compiler/NFFrontEnd/NFModelicaBuiltin.mo
Expand Up @@ -3037,7 +3037,7 @@ function plot "Launches a plot window using OMPlot."
input Boolean externalWindow = false "Opens the plot in a new plot window";
input String fileName = "<default>" "The filename containing the variables. <default> will read the last simulation result";
input String title = "" "This text will be used as the diagram title.";
input String grid = "detailed" "Sets the grid for the plot i.e simple, detailed, none.";
input String grid = "simple" "Sets the grid for the plot i.e simple, detailed, none.";
input Boolean logX = false "Determines whether or not the horizontal axis is logarithmically scaled.";
input Boolean logY = false "Determines whether or not the vertical axis is logarithmically scaled.";
input String xLabel = "time" "This text will be used as the horizontal label in the diagram.";
Expand Down Expand Up @@ -3075,7 +3075,7 @@ function plotAll "Works in the same way as plot(), but does not accept any
input Boolean externalWindow = false "Opens the plot in a new plot window";
input String fileName = "<default>" "The filename containing the variables. <default> will read the last simulation result";
input String title = "" "This text will be used as the diagram title.";
input String grid = "detailed" "Sets the grid for the plot i.e simple, detailed, none.";
input String grid = "simple" "Sets the grid for the plot i.e simple, detailed, none.";
input Boolean logX = false "Determines whether or not the horizontal axis is logarithmically scaled.";
input Boolean logY = false "Determines whether or not the vertical axis is logarithmically scaled.";
input String xLabel = "time" "This text will be used as the horizontal label in the diagram.";
Expand Down Expand Up @@ -3104,7 +3104,7 @@ function plotParametric "Launches a plotParametric window using OMPlot. Returns
input Boolean externalWindow = false "Opens the plot in a new plot window";
input String fileName = "<default>" "The filename containing the variables. <default> will read the last simulation result";
input String title = "" "This text will be used as the diagram title.";
input String grid = "detailed" "Sets the grid for the plot i.e simple, detailed, none.";
input String grid = "simple" "Sets the grid for the plot i.e simple, detailed, none.";
input Boolean logX = false "Determines whether or not the horizontal axis is logarithmically scaled.";
input Boolean logY = false "Determines whether or not the vertical axis is logarithmically scaled.";
input String xLabel = "" "This text will be used as the horizontal label in the diagram.";
Expand Down
2 changes: 2 additions & 0 deletions OMPlot/OMPlot/OMPlotGUI/PlotApplication.cpp
Expand Up @@ -40,6 +40,8 @@ using namespace OMPlot;
PlotApplication::PlotApplication(int &argc, char *argv[], const QString uniqueKey)
: QApplication(argc, argv)
{
setAttribute(Qt::AA_DontShowIconsInMenus, false);
setAttribute(Qt::AA_UseHighDpiPixmaps);
mSharedMemory.setKey(uniqueKey);

if (mSharedMemory.attach())
Expand Down
2 changes: 1 addition & 1 deletion OMPlot/OMPlot/OMPlotGUI/PlotGrid.h
Expand Up @@ -43,7 +43,7 @@ class PlotGrid : public QwtPlotGrid
public:
PlotGrid(Plot *pParent);
~PlotGrid();
QPen getMajorPen() {return QPen(Qt::gray);}
QPen getMajorPen() {return QPen(QColor(242, 242, 242));} // #F2F2F2 light gray color. More lighter than Qt::lightGray
QPen getMinorPen() {return QPen(Qt::lightGray, 0.0, Qt::DotLine);}
void setGrid();
void setDetailedGrid();
Expand Down
17 changes: 6 additions & 11 deletions OMPlot/OMPlot/OMPlotGUI/PlotWindow.cpp
Expand Up @@ -81,7 +81,7 @@ void PlotWindow::setUpWidget()
// set the plot title
setTitle(tr("Plot by OpenModelica"));
// set the plot grid
setDetailedGrid(true);
setGrid(true);
}

void PlotWindow::initializePlot(QStringList arguments)
Expand Down Expand Up @@ -1421,17 +1421,12 @@ void PlotWindow::updatePlot()

void PlotWindow::setGrid(QString grid)
{
if (grid.toLower().compare("simple") == 0)
{
setGrid(true);
}
else if (grid.toLower().compare("none") == 0)
{
setNoGrid(true);
}
else
{
if (grid.toLower().compare("detailed") == 0) {
setDetailedGrid(true);
} else if (grid.toLower().compare("none") == 0) {
setNoGrid(true);
} else {
setGrid(true);
}
}

Expand Down
3 changes: 3 additions & 0 deletions OMPlot/OMPlot/OMPlotGUI/main.cpp
Expand Up @@ -237,6 +237,9 @@ int main(int argc, char *argv[])
arguments.append(autoScale ? "true" : "false");
arguments.append(vars);
// create the plot application object that is used to check that only one instance of application is running
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
PlotApplication app(argc, argv, "OMPlot");
// create the plot main window
PlotMainWindow w;
Expand Down

0 comments on commit 756aa34

Please sign in to comment.