Giter Site home page Giter Site logo

jkriege2 / jkqtplotter Goto Github PK

View Code? Open in Web Editor NEW
764.0 42.0 178.0 1.21 GB

an extensive Qt5 & Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies

Home Page: http://jkriege2.github.io/JKQtPlotter/index.html

License: GNU Lesser General Public License v2.1

C++ 96.25% QMake 0.56% TeX 1.71% Python 0.27% Makefile 0.03% C 0.18% CMake 1.00%
plot qt5 qt5-widgets scientific-visualization plotting graphics-programming barchart charting-library qt charting

jkqtplotter's People

Contributors

akenmorris avatar certik avatar cvilas avatar doug1234 avatar dtimson avatar fpalazzolo avatar jkriege2 avatar midjji avatar neumann-a avatar patstew avatar social-mean avatar srazi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jkqtplotter's Issues

Enable set font size to `JKQTMathText` in pixels.

Hello. The subject.

Corresponding to the code:

class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
    protected:
        /** \brief base font size in points */
        double fontSize;

Font size in JKQTMathText is set with points, that is platform dependent, as Qt for a long time is not accurate in this question. I did a lot of applications where were necessary to see the same picture on all devices, and I was forced to calculate fonts' sizes by hands and set them in pixels.

Thanks.

Undefined behaviour in jkqtp_format

The utility function 'std::string jkqtp_format(const std::string& templ, ...)' uses a reference 'templ' which doesn't work at all with va_start. Every call gets a different result.

My environment: Windows 10, VS2017

Build error when JKQtPlotter_BUILD_INCLUDE_XITS_FONTS set to OFF

Turning off the cmake option JKQtPlotter_BUILD_INCLUDE_XITS_FONTS causes the following error on windows (MSVC 2019, Qt 5.14):

jkqtmathtext.obj : error LNK2019: unresolved external symbol "int __cdecl qInitResources_xits(void)" (?qInitResources_xits@@YAHXZ) referenced in function "public: __cdecl JKQTMathText::JKQTMathText(class QObject *)" (??0JKQTMathText@@QEAA@PEAVQObject@@@Z)

Most likely caused by the following line in jkqtmathtext.cpp:

Q_INIT_RESOURCE(xits);

CMake now broken on Linux

The latest CMake change works on macOS, but not on Linux:

$ cmake -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ..
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:13 (include):
  include could not find load file:

    JKQtPlotter_LIB_properties


-- 
-- =============================================================================
-- == JKQTPlotterLib Build Information                                        ==
-- =============================================================================
-- Version:           
-- Using compiler:    GNU 7.4.0
-- Architecture:      x86_64-linux-gnu / x86_64-linux-gnu
-- System Name:       Linux
-- Processor Name:    x86_64
-- Using Qt:          5.12.5
--                      [at /home/certik/miniconda3/envs/qt/lib/cmake/Qt5]
-- Using XITS fonts
-- Installing to:     /home/certik/miniconda3/envs/qt
-- =============================================================================
-- 
-- -- Building JKQTCommonSharedLib
CMake Error at /home/certik/miniconda3/envs/qt/share/cmake-3.15/Modules/WriteBasicConfigVersionFile.cmake:43 (message):
  No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
Call Stack (most recent call first):
  /home/certik/miniconda3/envs/qt/share/cmake-3.15/Modules/CMakePackageConfigHelpers.cmake:225 (write_basic_config_version_file)
  lib/jkqtcommon/CMakeLists.txt:85 (write_basic_package_version_file)


-- Configuring incomplete, errors occurred!
See also "/home/certik/repos/JKQtPlotter/build/CMakeFiles/CMakeOutput.log".

Add JKQtPlotter to QTabWidget

I run into a problem with a error QWidget: Must construct a QApplication before a QWidget, which crashes down the Qt Application.

The following is how I run into the problem.

  1. Firstly, custom a widget for JKQtPlotter, i.e.,
// profile.h
#ifndef PROFILE_H
#define PROFILE_H

#include <QWidget>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/graphs/jkqtpscatter.h"

class Profile : public QWidget
{
    Q_OBJECT

public:
    Profile(QWidget *parent = nullptr);
    Profile();
    void show(std::string &name);
private:
    JKQTPlotter* plot;
};

#endif // PROFILE_H

// profile.cpp
#include "profile.h"
Profile::Profile(QWidget *parent)
    : QWidget(parent)
{
}

void Profile::show(std::string couplename)
{
    plot=new JKQTPlotter(this);

    QHBoxLayout *layout=new QHBoxLayout;
    this->setLayout(layout);
    layout->addWidget(plot);

    // omitted: code for plotting
    plot->zoomToFit();
}

  1. Add new tab to QTabWidget in the MainWindow
     Profile *p = new Profile(this);
     p->show(this->couplename.toStdString());
    this->ui->tabWidget->addTab(p, "name");

I came across the example in the JKQtPlotter/examples, but I am still hard to figure out whether it is problem with QT or JKQtPlotter. Thus, an issue is raised here for some kind instruction. What's more, an example to add JKQtPlotter to a QTabWidget would be very helpful to someone with the same purpose.

Many thanks for your consideration!

Yours,

Sincerely

Lot of errors of the type "##SEARCHING ";" : DIDN'T FIND!"

When running most examples, for example the "ui" one, there are lots of errors printed into the terminal of the type:

##SEARCHING  ";"
##SEARCHING  ";" : SEARCHING IN  "XITS"  [unicode]
##SEARCHING  ";" : SEARCHING IN  "XITS"  [winSym]
##SEARCHING  ";" : DIDN'T FIND!

What does that mean? How can one fix that?

I use Ubuntu 18.04.

Logscale zoom multiple zeros?

Hi I ran into a problem.

In logscale if the values are so small there is couple of 0 values shown more than once in Y axis like that how to avoid that? Also if you doo zoom operations it can be more or less zeros.
23

User-defined palette for image plots

As far as I can see, it's not possible to define & use an arbitrary palette for image plots.

Looking at the code, it seems that a few changes to JKQTPMathImage would support this, making use of the JKQTPMathImageUSER_PALETTE option. Would it be OK if I sent a pull-request to show you what I mean?

PS - thanks for writing a great library!

CMake files not automatically picked up

I install JKQtPlotter using:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME/ext/jkqtplotter/ ..
make
make install

Then when building my application, my CMakeLists.txt contains:

# Qt
find_package(Qt5 COMPONENTS Core Widgets PrintSupport Svg Xml REQUIRED)

# JKQtPlotter
find_package(JKQTCommonLib REQUIRED)
find_package(JKQTMathTextLib REQUIRED)
find_package(JKQTPlotterLib REQUIRED)

The way it should be possible to build my application is:

cmake -DCMAKE_PREFIX_PATH=$HOME/ext/jkqtplotter/ .

But it fails to find the JKQtPlotter cmake files. Instead, one must do:

cmake -DCMAKE_PREFIX_PATH=$HOME/ext/jkqtplotter/lib/cmake .

Then everything works.

By looking at how other libraries do that, they seem to put the cmake files into $PREFIX/lib/cmake/JKQTCommonLib/. When I manually create lib/cmake/JKQTCommonLib and move the files there, then cmake automatically finds them. It fails because some paths are not adjusted correctly, but it shows how to fix this problem. One also has to create directories JKQTMathTextLib and JKQTPlotterLib.

What I don't know is how to modify the CMake build system in JKQtPlotter to do this automatically.

Note: I actually create a Conda environment and install JKQtPlotter into it. CMake picks up any library out of the box from the Conda environment, except JKQtPlotter due to the problem I reported above. It would be really nice to fix this so that things work out of the box.

Build error on mac jkqtfastplotter.cpp:342:28: Variable has incomplete type 'QPainterPath'

Hi @jkriege2 ,

I am very eager to try this out, but I am facing the following build error while trying to build on macOS Catalina (v 10.15.5):

~/jkqtplotter/lib/jkqtmathtext/jkqtmathtext.cpp:40:18: error:
variable has incomplete type 'QPainterPath'
QPainterPath path;
^
In file included from ~/jkqtplotter/lib/jkqtmathtext/jkqtmathtext.cpp:22:
In file included from ~/jkqtplotter/lib/jkqtmathtext/jkqtmathtext.h:35:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/QPainter:1:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qpainter.h:48:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qpixmap.h:49:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qimage.h:48:
In file included from /usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qtransform.h:43:
/usr/local/Cellar/qt/5.15.0/lib/QtGui.framework/Headers/qmatrix.h:54:7: note:
forward declaration of 'QPainterPath'
class QPainterPath;

The workflow I followed:

  1. Installed qt using homebrew:
    % brew install qt5

  2. cmake .. -G "Xcode" "-DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt/5.15.0" (This step worked fine)

  3. cmake --build . --config "Debug" --> This step gave the above mentioned build error

Please let me know if there is any fix/workaround for this. Also let me know if you need more info from my side.

Failure on Windows

I am trying to get JKQtPlotter into Conda and I got it building on Linux and macOS, but I can't get it to build on Windows. Here is the PR:

conda-forge/staged-recipes#10339

As you can see, I am really struggling to get it working on Windows. Any help would be appreciated.

const class `QFontMetricsF` has no member named `width`

Hello,

I pulled you changes to set font size in pixels and build fails here:

double JKQTMathTextWhitespaceNode::Type2PixelWidth(Types type, JKQTMathTextEnvironment currentEv, QPaintDevice* pd) const
{
    const QFontMetricsF fm(currentEv.getFont(parentMathText), pd);
#if QT_VERSION >= QT_VERSION_CHECK(5,11,0)
    const double em=fm.horizontalAdvance(QChar(0x2003));//currentEv.fontSize;
#else
    const double em=fm.width(QChar(0x2003));//currentEv.fontSize;
#endif
    const double en=em/2.0;
    switch (type) {
        case WSTNormal: return fm.width(' ');
        case WSTNonbreaking: return fm.width(' ');
        case WST1en: return en;
        case WST1em: return em;
        case WSThair: return em/12.0;
        case WSTthin: return em/6.0;
        case WSTnegthin: return -em/6.0;
        case WSTmedium: return em*2.0/9.0;
        case WSTnegmedium: return -em*2.0/9.0;
        case WSTthick: return em*5.0/18.0;
        case WSTnegthick: return -em*5.0/18.0;
        case WSTthicker: return em/3.0;
    }
    return 0.0;
}

With:

/home/igor/Work/Projects/md-pdf/3rdparty/JKQtPlotter/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp:171: error: ‘const class QFontMetricsF’ has no member named ‘width’
/home/igor/Work/Projects/md-pdf/3rdparty/JKQtPlotter/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp: In member function ‘double JKQTMathTextWhitespaceNode::Type2PixelWidth(JKQTMathTextWhitespaceNode::Types, JKQTMathTextEnvironment, QPaintDevice*) const’:
/home/igor/Work/Projects/md-pdf/3rdparty/JKQtPlotter/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp:171:35: error: ‘const class QFontMetricsF’ has no member named ‘width’
  171 |         case WSTNormal: return fm.width(' ');
      |                                   ^~~~~

And

/home/igor/Work/Projects/md-pdf/3rdparty/JKQtPlotter/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp:172: error: ‘const class QFontMetricsF’ has no member named ‘width’
/home/igor/Work/Projects/md-pdf/3rdparty/JKQtPlotter/lib/jkqtmathtext/nodes/jkqtmathtextwhitespacenode.cpp:172:40: error: ‘const class QFontMetricsF’ has no member named ‘width’
  172 |         case WSTNonbreaking: return fm.width(' ');
      |                                        ^~~~~

Compile Error,Qt5.12.11+MSVC2019

jkqtpmathparser.obj:-1: error: LNK2019: 无法解析的外部符号 "public: __cdecl JKQTPMathParser::jkmpResult::jkmpResult(void)" (??0jkmpResult@JKQTPMathParser@@qeaa@XZ),函数 "struct JKQTPMathParser::jkmpResult __cdecl `anonymous namespace'::fFloatToStr(struct JKQTPMathParser::jkmpResult *,unsigned char,class JKQTPMathParser *)" (?fFloatToStr@?A0x48c32274@@ya?AUjkmpResult@JKQTPMathParser@@PEAU23@EPEAV3@@z) 中引用了该符号

jkqtpimagergb.obj:-1: error: LNK2001: 无法解析的外部符号 "public: virtual __cdecl JKQTPSaveDataAdapter::~JKQTPSaveDataAdapter(void)" (??1JKQTPSaveDataAdapter@@UEAA@XZ)

moc_jkqtplotter.obj:-1: error: LNK2001: 无法解析的外部符号 "public: virtual class QPaintDevice * __cdecl JKQTPPaintDeviceAdapter::createPaintdeviceMM(class QString const &,double,double)const " (?createPaintdeviceMM@JKQTPPaintDeviceAdapter@@UEBAPEAVQPaintDevice@@AEBVQString@@nn@Z)

jkqtplotterlib_debug.lib(jkqtplotter.obj):-1: error: LNK2019: 无法解析的外部符号 "public: void __cdecl JKQTBasePlotter::drawNonGrid(class JKQTPEnhancedPainter &,class QPoint const &)" (?drawNonGrid@JKQTBasePlotter@@QEAAXAEAVJKQTPEnhancedPainter@@AEBVQPoint@@@z),函数 "public: void __cdecl JKQTPlotter::redrawPlot(void)" (?redrawPlot@JKQTPlotter@@QEAAXXZ) 中引用了该符号

jkqtplotterlib_debug.lib(jkqtpgraphsbaseerrors.obj):-1: error: LNK2019: 无法解析的外部符号 "public: enum Qt::PenStyle __cdecl JKQTBasePlotter::JKQTPPen::errorStyle(void)const " (?errorStyle@JKQTPPen@JKQTBasePlotter@@qeba?AW4PenStyle@Qt@@xz),函数 "public: void __cdecl JKQTPGraphErrorStyleMixin::initErrorStyle(class JKQTBasePlotter *,int &,enum JKQTPPlotStyleType)" (?initErrorStyle@JKQTPGraphErrorStyleMixin@@QEAAXPEAVJKQTBasePlotter@@AEAHW4JKQTPPlotStyleType@@@z) 中引用了该符号

Android Build Problem

Hello I wanna use JKQTplotter but just the jkqtmathtext in y android application I can build it for x86_64 & x86 platforms but it gives error in armeabi-v7a and arm64-v8a:

I use opencv for android btw.
armeabi-v7a CMake command:
-DCMAKE_TOOLCHAIN_FILE="/home/sufuk/Android/Sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake" -DANDROID_ABI="armeabi-v7a" -DANDROID_PLATFORM="android-27" -DQt5_DIR="/home/sufuk/Qt/5.15.2/android/lib/cmake/Qt5" -DOpenCV_DIR=/opt/OpenCV-android-sdk/sdk/native/jni/ -DCMAKE_INSTALL_PREFIX="/opt/JKQTPlotter/android" -DCMAKE_BUILD_TYPE="Release"

It gives an error after loading cmake:
error: unknown target CPU 'armv7-a'

arm64-v8a CMake command:
-DCMAKE_TOOLCHAIN_FILE="/home/sufuk/Android/Sdk/ndk/21.4.7075529/build/cmake/android.toolchain.cmake" -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM="android-27" -DQt5_DIR="/home/sufuk/Qt/5.15.2/android/lib/cmake/Qt5" -DOpenCV_DIR=/opt/OpenCV-android-sdk/sdk/native/jni/ -DCMAKE_INSTALL_PREFIX="/opt/JKQTPlotter/android" -DCMAKE_BUILD_TYPE="Release"

It gives an error after build:
/home/sufuk/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libGLESv2.so, needed by /home/sufuk/Qt/5.15.2/android/lib/libQt5Svg_arm64-v8a.so, not found (try using -rpath or -rpath-link) /home/sufuk/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libz.so, needed by /home/sufuk/Qt/5.15.2/android/lib/libQt5Svg_arm64-v8a.so, not found (try using -rpath or -rpath-link) /home/sufuk/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: liblog.so, needed by /home/sufuk/Qt/5.15.2/android/lib/libQt5Svg_arm64-v8a.so, not found (try using -rpath or -rpath-link) /home/sufuk/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: libc++_shared.so, needed by /home/sufuk/Qt/5.15.2/android/lib/libQt5Svg_arm64-v8a.so, not found (try using -rpath or -rpath-link) /home/sufuk/Qt/5.15.2/android/lib/libQt5Gui_arm64-v8a.so: undefined reference to deflateInit_

Why it compiles for x86 & x86_64 but not others thank you very much need help I wanna use in my graduation project.

Unable to build with Qt6.3

Error:
E:\Repos\AllProjects\build\vcpkg_installed\x64-windows-llvm\include\Qt6\QtCore/qmetatype.h(872,49): error: member 'qt_check_for_QGADGET_macro' found in multiple base classes of different types IsRealGadget = sizeof(checkType(&T::qt_check_for_QGADGET_macro)) == sizeof(void *),
real error:

E:\b\jkqtplotter\src\18a82dc8c7-5815fd25be.clean\lib\.\jkqtplotter/jkqtpgraphsbasestylingmixins.h(49,9): note: member found by ambiguous name lookup
        Q_GADGET
        ^

Full log:
install-x64-windows-llvm-dbg-out.log

vcpkg overlay-ports for building jkqtplotter using vcpkg:
https://github.com/Neumann-A/my-vcpkg-ports/tree/master/jkqtplotter

MSVC builds fail on Appveyor

Currently all MSVC builds fail on Appveyor with:

C:\projects\jkqtplotter\lib\jkqtplotter\jkqtpdatastorage.cpp(419): error C2589: '(': illegal token on right side of '::' [C:\projects\jkqtplotter\build\lib\jkqtplotter\JKQTPlotterSharedLib.vcxproj]
C:\projects\jkqtplotter\lib\jkqtplotter\jkqtpdatastorage.cpp(419): error C2062: type 'unknown-type' unexpected [C:\projects\jkqtplotter\build\lib\jkqtplotter\JKQTPlotterSharedLib.vcxproj]

Here is an example: https://ci.appveyor.com/project/jkriege2/jkqtplotter/builds/28944823/job/wyrb933f0pgr4de8.

Some qustion about JKQTmathText

  1. Is there a way to know how good a LaTeX string was parsed? Maybe something like count of unknown symbols?

  2. I want to draw LaTeX string to a pixmap as small as it can be. Is calling JKQTmathText::getSize(painter) the fatest way? (Does getSize() really use painter? I see it is not used in some nodes.)

  3. Is JKQTmathText::draw() fast enough or I should cache the resulting pixmap?

Failure on Windows

I am trying to update JKQtPlotter in Conda:

conda-forge/jkqtplotter-feedstock#4

and things build on Linux and macOS, but I am having some issue on Windows:

https://dev.azure.com/conda-forge/84710dde-1620-425b-80d0-4cf5baca359d/_apis/build/builds/179691/logs/25

and I don't quite understand from the log where the error happens. The build seems to simply stop but for no reason:

2020-06-30T16:15:07.8000101Z [21/81] Building CXX object lib\jkqtcommon\CMakeFiles\JKQTCommonSharedLib.dir\jkqtpstatgrouped.cpp.obj
2020-06-30T16:15:07.8001594Z cl : Command line warning D9002 : ignoring unknown option '-G='
2020-06-30T16:15:07.8522381Z [22/81] Linking CXX shared library output\JKQTCommonSharedLib_Release.dll
2020-06-30T16:15:07.8523995Z FAILED: output/JKQTCommonSharedLib_Release.dll lib/jkqtcommon/JKQTCommonSharedLib_Release.lib 

@jkriege2 do you have any ideas what the problem could be?

Buffer overflow

Hello, my friend.

Thanks for sharing this wonderful package.

I found a little buffer overflow which goes unnoticed on x86_64, but prevents the libs from running at least on ARM32 (Raspberry Pi).

If you run one of the examples with the 'valgrind' memory leak & buffer overflow error detection tool, you will find that "JKQTPImageTools::getDefaultLUTs()" gives a series of invalid writes of 4 bytes each.

Inspecting the code at "lib/jkqtcommon/jkqtpbasicimagetools.cpp", I believe that the lines like:
plut[JKQTPImageTools::LUTSIZE+1]=plut[JKQTPImageTools::LUTSIZE];

are not necessary (the last element is already set on the loop... and the element at JKQTPImageTools::LUTSIZE+1 seems to be out of bounds, since, for what I understood, you allocate an array with that same size).

On Raspberry Pi 1, loading the libraries fail with the message:
malloc(): corrupted top size
Aborted (core dumped)
... indicating that the overflow corrupted the heap. A hard to follow issue without valgrind.

After deleting these lines, everything seems to run as intended both on x86_64 (linux) and Raspberry Pi.

Hope this report helps you to inspect the issue.

Possible typo in jkqtplotter/CMakeLists.txt

I think there is a typo in jkqtplotter/CMakeLists.txt

Should change HEADERS to HEADERS_BASE

Currently it is

install(FILES ${HEADERS}
		DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
		COMPONENT Headers)

However it should be

install(FILES ${HEADERS_BASE}
		DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${libIncludeSubdir}
		COMPONENT Headers)

How to build qt shared library ?

How to build qt shared library ?

My project

the app works perfectly if I build it as an app.

TEMPLATE = app

If I create a shared lib with same code the code not gives result.

I changed TEMPLATE = app to TEMPLATE = lib and I compile the same code. But , the result comes an error.

code not give result as a qt shared lib

wifimouse app fully build with qt.

Source code of wifimouse server application

I install and run wifimouse app in my computer it works perfectly and all the options are works smoothly.

But, If I compile the same code as a shared lib in my computer it not works properly.

For example ; In wifimouse application there is an option for brightness controling

Brightness code

enter image description here

error comes like this. But , it works smoothly as a TEMPLATE = app.

Problem with qt in getting outputs.

My project

I want to get the cpu usage , ram usage ,process list and app list with qt.

In Windows

windows os

I am getting ram usage from this code.

But app list , cpu usage and process outputs are not showed.

In linux

enter image description here

In linux the cpu usage output not showed.

In Mac

enter image description here

In mac the app list output not showed.

All the code works perfectly if I build it as an app.

Why this problem occured ?

Slow rendering

Here is how I call JKQtPlotter:

QVector<double> fromCArray(const double *x, size_t len)
{
    QVector<double> Y;
    Y.reserve(len);
    Y.resize(len);
    std::memcpy(Y.data(), x, len * sizeof(double));
    return Y;
}

void MainWindow::plot(const std::vector<double> &R,
                      const std::vector<double> &T,
                      const std::vector<double> &P)
{
    size_t step = T.size()/10;
    if (step == 0) step = 1;
    JKQTPDatastore* ds=ui->plot->getDatastore();
    ui->plot->clearGraphs(true);
    for (size_t i=0; i < T.size()-1; i += step) {
        QVector<double> X, Y;
        X = QVector<double>::fromStdVector(R);
        Y = fromCArray(&P[i*R.size()], R.size());
        graph = new JKQTPXYLineGraph(ui->plot);
        size_t columnX=ds->addCopiedColumn(X, "x");
        size_t columnY=ds->addCopiedColumn(Y, "y");
        graph->setXColumn(columnX);
        graph->setYColumn(columnY);
        graph->setSymbolType(JKQTPNoSymbol);
        ui->plot->addGraph(graph);
    }
    ui->plot->getXAxis()->setLogAxis(true);
    ui->plot->getYAxis()->setLogAxis(true);
    ui->plot->getXAxis()->setAxisLabel("Density [g / cm$^3$]");
    ui->plot->getYAxis()->setAxisLabel("Pressure [GPa]");
    ui->plot->getXAxis()->setTickLabelFontSize(14);
    ui->plot->getYAxis()->setTickLabelFontSize(14);
    ui->plot->getXAxis()->setLabelFontSize(14);
    ui->plot->getYAxis()->setLabelFontSize(14);
    ui->plot->zoomToFit();
}

And it takes about 0.5s to render. That seems really slow. @jkriege2 do you see any obvious inefficiency? I can see that the data is first copied from std::vector to QVector and then copied again (I assume) into JKQTPDatastore. Otherwise is this how JKQtPlotter should be used?

slow startup (QFontDatabase?)

Hi, thank you for your great library which I enjoy using for the first time very much! I have some issues, I am not sure whether it is my lack of experience with the internals.

The most acute one is that JKQtPlotter is apparently scanning the whole system for all installed fonts and it takes lots of time. On my workstation (which has 64GB RAM, used mostly for disk cache, thus no actual disk access is entailed) this takes 10 seconds (full installatoin of TeXLive and several extra font packs); this is what strace is showing during those 10s:

...
openat(AT_FDCWD, "/usr/share/fonts/truetype/larabie/duality_.ttf", O_RDONLY) = 23
fcntl(23, F_SETFD, FD_CLOEXEC)          = 0
fstat(23, {st_mode=S_IFREG|0644, st_size=49276, ...}) = 0
mmap(NULL, 49276, PROT_READ, MAP_PRIVATE, 23, 0) = 0x7fedf0338000
close(23)                               = 0
openat(AT_FDCWD, "/usr/share/fonts/truetype/larabie/dyspepsi.ttf", O_RDONLY) = 23
fcntl(23, F_SETFD, FD_CLOEXEC)          = 0
fstat(23, {st_mode=S_IFREG|0644, st_size=43308, ...}) = 0
mmap(NULL, 43308, PROT_READ, MAP_PRIVATE, 23, 0) = 0x7fedf032d000
close(23)                               = 0
...

Would it be possible to avoid this? I would be fine building without the math rendering library -- currently there is no option for that in cmake, could I help adding such option perhaps? Maybe you have some other pro tip :)

Thanks!

Could NOT find CImg (missing: CIMG_INCLUDE_DIR CImg_FOUND)

After #21 is in, there is another issue on Linux (Ubuntu 18.04) that was not there before:

-- CImg: trying to locate CImg library
-- Could NOT find CImg (missing: CIMG_INCLUDE_DIR CImg_FOUND) 
-- ..   Building Example rgbimageplot_qt
-- ..   Building Example simpletest
-- ..   Building Example speed
-- ..   Building Example stackedbars
-- ..   Building Example stepplots
-- ..   Building Example styledboxplot
-- ..   Building Example styling
-- ..   Building Example symbols_and_errors
-- ..   Building Example symbols_and_styles
-- ..   Building Example ui
-- ..   Building Example user_interaction
-- ..   Building Example violinplot
-- Configuring incomplete, errors occurred!
See also "/home/certik/repos/JKQtPlotter/build/CMakeFiles/CMakeOutput.log".

'runtime_error': is not a member of 'std'

Build environments is

  • JKQtPlotter: v2019.11.3
  • CMake 3.17.5
  • Generator: Visual Studio 16 2019

I got error during build the JKQTCommonSharedLib project with Debug(x64) configuration.
It seems like missing #include <stdexcept> header.
When I include stdexcept header in jkqtpdebuggingtools.h, build is success.

The following are build log.

1>------ Build started: Project: JKQTCommonSharedLib, Configuration: Debug x64 ------
1>Automatic MOC and UIC for target JKQTCommonSharedLib
1>jkqtpdebuggingtools.cpp
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(84,20): error C2039: 'runtime_error': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\include\iterator(21): message : see declaration of 'std'
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(84,33): error C3861: 'runtime_error': identifier not found
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(103,20): error C2039: 'runtime_error': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\include\iterator(21): message : see declaration of 'std'
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(103,33): error C3861: 'runtime_error': identifier not found
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(121,20): error C2039: 'runtime_error': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\include\iterator(21): message : see declaration of 'std'
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(121,33): error C3861: 'runtime_error': identifier not found
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(138,20): error C2039: 'runtime_error': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\include\iterator(21): message : see declaration of 'std'
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(138,33): error C3861: 'runtime_error': identifier not found
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(153,20): error C2039: 'runtime_error': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\include\iterator(21): message : see declaration of 'std'
1>E:\devel\JKQtPlotter\lib\jkqtcommon/jkqtpdebuggingtools.h(153,33): error C3861: 'runtime_error': identifier not found
1>jkqtpstatpoly.cpp
1>Generating Code...
1>Done building project "JKQTCommonSharedLib.vcxproj" -- FAILED.

Double-click Zoom-in ISSUE

Hi, I wrote some code to disable default double-click action

plot = new JKQTPlotter(this);
plot->clearAllRegisteredMouseDoubleClickActions(); // this code should block default-click action, which is zoom-in.
plot->clearAllMouseWheelActions();
plot->clearAllMouseWheelActions();

However, when program first start, I still can zoom-in by double-clicking the plotter (only once). I find this function may cause this problem:

    for (JKQTPMouseDoubleClickActionsHashMapIterator it=plotterStyle.registeredMouseDoubleClickActions.begin(); it!=plotterStyle.registeredMouseDoubleClickActions.end(); ++it) {
        if (it.key()==qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)) {
            return it;
        }
    }
    return plotterStyle.registeredMouseDoubleClickActions.end();
// ....
auto itAction=findMatchingMouseDoubleClickAction(event->button(), event->modifiers());

The return-value itAction is not equal to plotterStyle.registeredMouseDoubleClickActions.end() which is very strange.

Intalling JKQTPlotter on Ubuntu 20.04 & QtCreator 6.0.1

Hello jkriege2. I'm a bit of a Qt/linux newbie, but now managing to find my way around. I'd love to use JKQTPlotter in several projects I have using the Qt UI system, but have not managed to follow your instructions.
My system:Qt Creator 6.0.1 Based on Qt 6.2.2 (GCC 10.3.1 20210422 (Red Hat 10.3.1-1), 64 bit) Built on Dec 15 2021 08:27:24
Using Qt 5.15.2 with GCC:
image
I have downloaded JKQTPlotter to /home/john/JKQTPlotter, and opened the file JKQTPlotter-BuildAllExamples.pro in QtCreator. On building it, I get a lot of errors about cannot find -ljkqtplotterlib_debug.
I don't see the built library files in the /lib or /qmake/staticlib folders.
I've tried various combinations of building the individual example projects (with & without building the lib), or building the qmake/staticlib/jkqtplotterlib/jkqtplotterlib.pro (again in QtCreator), with no more success.
Is this an issue with QtCreator 6 - I note a previous comment that this wasn't supported yet?
Or is there an obvious installation step I've missed out?
Thanks for any pointers - your package does look very much what I'm looking for.
John

JKQT libraries do not have the proper RPATH setup on Linux

With the latest master (cbd9882) I am now facing another problem:

$ ldd my_application
	linux-vdso.so.1 (0x00007ffda94ce000)
	libJKQTPlotterSharedLib_.so.2019.11 => /home/certik/miniconda3/envs/qt/lib/libJKQTPlotterSharedLib_.so.2019.11 (0x00007fcc9eb9d000)
	libQt5Widgets.so.5 => /home/certik/miniconda3/envs/qt/lib/libQt5Widgets.so.5 (0x00007fcc9e656000)
	libQt5Gui.so.5 => /home/certik/miniconda3/envs/qt/lib/libQt5Gui.so.5 (0x00007fcc9e249000)
	libQt5Core.so.5 => /home/certik/miniconda3/envs/qt/lib/libQt5Core.so.5 (0x00007fcc9ddf1000)
	libstdc++.so.6 => /home/certik/miniconda3/envs/qt/lib/libstdc++.so.6 (0x00007fcc9f357000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcc9da53000)
	libgcc_s.so.1 => /home/certik/miniconda3/envs/qt/lib/libgcc_s.so.1 (0x00007fcc9f325000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcc9d662000)
	libQt5Svg.so.5 => not found
	libJKQTMathTextSharedLib_.so.2019.11 => not found
	libJKQTCommonSharedLib_.so.2019.11 => not found
	libQt5PrintSupport.so.5 => not found

As you can see, some Qt5 libraries and libJKQTPlotterSharedLib have the proper RPATH, but the libQt5Svg, libQt5PrintSupport, libJKQTMathTextSharedLib and libJKQTCommonSharedLib libraries do not.

Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.15.5 FATAL_ERROR)

project(my_application LANGUAGES CXX)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

# Qt
find_package(Qt5 COMPONENTS Core Widgets PrintSupport Svg Xml REQUIRED)

# JKQtPlotter
find_package(JKQTCommonSharedLib REQUIRED)
find_package(JKQTMathTextSharedLib REQUIRED)
find_package(JKQTPlotterSharedLib REQUIRED)

add_executable(my_application main.cpp mainform.cpp mainform.ui)
target_link_libraries(my_application JKQTPlotterSharedLib)

Please clarify in the comment...

Hello.

Please clarify in the comment of the JKQTMathText method:

/** \brief draw a representation to the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> object at the specified position */
void draw(QPainter& painter, double x, double y, bool drawBoxes=false);

What x and y should point to. Is it a top-left corner, center, or something else?

I tried to figure out and check in the code, but if to set x and y to 0, then there is no image drawn, whereas with:

void draw(QPainter& painter, unsigned int flags, QRectF rect, bool drawBoxes=false);

with rect = QRectF( QPointF( 0, 0 ), size ) everything draws correctly.

Thanks.

Could you implement `\over` command?

Hello. The subject...

Currently command \over is not implemented. For example:

x = {-b \pm \sqrt{b^2-4ac} \over 2a}

draws in one line with unknown character in place of \over, whereas it should render as:

$x = {-b \pm \sqrt{b^2-4ac} \over 2a}$

Thanks.

Show data tooltip on MouseMove

Hi,

first of all thanks for your amazing job into JKQtplotter. I would like to show the tooltip instead on the drag or the click action, on the mouse move event. Basically while hovering one datapoint. Can you address me how to achive this task?

Thanks!

X axis name affects the length of plot bottom border

The length of the x-axis name is positively related to the length of the bottom border of the chart. When the axis name becomes longer, the bottom border also changes, which looks very weird.
For example, you can try below code:
plotResid->getXAxis()->setAxisLabel("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx axis");

I want to show you my screenshots,but i didn't find the interface to add pictures.

Fails to build on macOS

I tried both gcc 9.1.0 and the default clang on macOS 10.11.6 and I got the same failure:

In file included from /Users/ondrej/repos/JKQtPlotter/lib/jkqtcommon/jkqtplinalgtools.h:39,
                 from /Users/ondrej/repos/JKQtPlotter/lib/jkqtcommon/jkqtplinalgtools.cpp:22:
/Users/ondrej/repos/JKQtPlotter/lib/./jkqtcommon/jkqtparraytools.h: In function ‘void* jkqtpArrayMalloc(size_t)’:
/Users/ondrej/repos/JKQtPlotter/lib/./jkqtcommon/jkqtparraytools.h:81:12: error: ‘_aligned_malloc’ was not declared in this scope
   81 |     return _aligned_malloc(size, JKQTP_ALIGNMENT_BYTES);
      |            ^~~~~~~~~~~~~~~
/Users/ondrej/repos/JKQtPlotter/lib/./jkqtcommon/jkqtparraytools.h: In function ‘void jkqtpArrayFree(void*)’:
/Users/ondrej/repos/JKQtPlotter/lib/./jkqtcommon/jkqtparraytools.h:122:9: error: ‘_aligned_free’ was not declared in this scope
  122 |         _aligned_free(data);
      |         ^~~~~~~~~~~~~
make[2]: *** [lib/jkqtcommon/CMakeFiles/JKQTCommonSharedLib.dir/jkqtplinalgtools.cpp.o] Error 1
make[1]: *** [lib/jkqtcommon/CMakeFiles/JKQTCommonSharedLib.dir/all] Error 2
make: *** [all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.