前提




qtchart 里的README文件(注意红色标记处)(本人翻译不行。多多见谅,也可以在评论里纠正( ⊙ o ⊙ ))




---------------

Qt Charts 5.7.0

---------------



Qt Charts module provides a set of easy to use chart components. It uses

the Qt Graphics View Framework, therefore charts can be easily integrated

to modern user interfaces.



System Requirements

===================



- Qt 5.4 or newer (Qt5.4或者更高的版本)

- For QML applications QtQuick 2 is required (对于QML程序,QtQuick2是必须的)

- Manipulating Qt Charts graphs with QML Designer requires Qt Creator 3.3 or newer (Qt Creator 3.3 或者更高的版本)



Building

========



Configure the project with qmake:

    qmake



After running qmake, build the project with make:

    (Linux) make

    (Windows with MinGw) mingw32-make

    (Windows with Visual Studio) nmake

    (OS X) make



The above generates the default makefiles for your configuration, which is typically

the release build if you are using precompiled binary Qt distribution. To build both

debug and release, or one specifically, use one of the following qmake lines instead.



For debug builds:

    qmake CONFIG+=debug

    make

  or

    qmake CONFIG+=debug_and_release

    make debug



For release builds:

    qmake CONFIG+=release

    make

  or

    qmake CONFIG+=debug_and_release

    make release



For both builds (Windows/OS X only):

    qmake CONFIG+="debug_and_release build_all"

    make



After building, install the module to your Qt directory:

    make install



If you want to uninstall the module:

    make uninstall



Building as a statically linked library

=======================================



The same as above applies, you will just have to add static to the CONFIG:

    qmake CONFIG+=static



Documentation

=============



The documentation can be generated with:

    make docs



The documentation is generated into the doc folder under the build folder.

Both Qt Assistant (qtcharts.qch) and in HTML format (qtcharts subfolder)

documentation is generated.



Please refer to the generated documentation for more information:

    doc/qtcharts/index.html



Known issues

============



- Zooming too far or too close may eventually freeze the zooming and scrolling.




编译




首先我们需要一份Qt Chart 5.7.0源码(源码于 上海Qt开发联盟 或 QT&C++编程爱好者 群共享中可见)


Qt Chart 5.7.0 傻瓜安装教程_html


○: 第一个是已经编译好的dll,可直接下载然后跳转到安装步骤


○: 第二个是qt chart 帮助文档


○: 第三个就是我们需要的源文件,点击下载它




下载解压后,我们轻松的看到这样一个画面:


Qt Chart 5.7.0 傻瓜安装教程_html_02


 


然后呢,我们双击qtchart.pro文件,进入Qt Creator


Qt Chart 5.7.0 傻瓜安装教程_源文件_03




很简单,点击运行按钮,选择release,然后进行编译:




Qt Chart 5.7.0 傻瓜安装教程_perl_04




注意:




○: 当你遇到以下情况时,下载​​windows下perl的安装和脚本的运行​​安装


Qt Chart 5.7.0 傻瓜安装教程_帮助文档_05




安装:


 


编译结束,我们能看到:


Qt Chart 5.7.0 傻瓜安装教程_帮助文档_06


Qt Chart 5.7.0 傻瓜安装教程_复制文件_07


 


点击开始菜单→ Qt 5.5.1(你的Qt版本)→ 5.5→ MinGW 4.9.2 (32-bit)(你的MinGW版本)→ Qt 5.5 for Desktop (MinGW 4.9.2 32 bit)


 


输入 cd /d 你的qtcharts编译好的文件路径


回车


mingw32-make install


回车


Qt Chart 5.7.0 傻瓜安装教程_perl_08






然后就是下面一大串的信息。。。


 


Qt Chart 5.7.0 傻瓜安装教程_帮助文档_09




测试 (此步骤选看)




待复制文件完毕后,打开qtcharts源文件下的example文件夹里的.pro文件




结果如下图:


Qt Chart 5.7.0 傻瓜安装教程_源文件_10


Qt Chart 5.7.0 傻瓜安装教程_复制文件_11


点击运行,运行结束后如下图所示:


Qt Chart 5.7.0 傻瓜安装教程_复制文件_12


 


 


 


然后你就可以看到如第二幅图qtcharts的样子了。