ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Using the ChartDirector and JUCE Gui program
Posted by Per-Erik Jansson on Apr-29-2019 02:20
I have been using ChartDirector together with MFC  but now I want to convert my program to modern C++ and I have been considering new GUI programs.

I noticed the Support for the Qt in the documentation but I am more interested in another newer system called JUCE that is also built on previous Qt versions.

JUCE have many support for Graphics and is using Modern C++ approach.

Do you know any experience of using JUCE together with ChartDirector. I am sure it is possible but it would be great with and example on how to do this similar as the

QtDemo Viewportcontroldemo.

Best regards

Per-Erik Jansson

Would be great to convert a lot of code from previous MFC to C++ and upgrading to latest version of ChartDirector with support for Qt. I have been using ChartDirector 5.6 and will be happy to upgrade to new version if it works for JUCE.

  Re: Using the ChartDirector and JUCE Gui program
Posted by Peter Kwan on Apr-29-2019 03:50
Hi Per-Erik.

Unluckily, we have never used JUCE before and are not familiar with it.

In C++, there are many GUI frameworks, and we are unable to provide sample code for all of them. What we do is we provide the source code for the GUI part of ChartDirector for the MFC and Qt framework. We hope people using other GUI frameworks can port those code to those frameworks. As an example, one of our customers have ported the ChartDirector GUI to wxWidgets.

https://www.wxwidgets.org/blog/2018/08/wxchartdir-using-chartdirector-in-wxwidgets-applications/

For Qt, the GUI part of ChartDirector is in qchartviewer.cpp / qchartviewer.h. For MFC, the GUI part is in ChartViewer.cpp / ChartViewer.h. All these files are included in the sample code that comes with ChartDirector.

For your case, if you are familiar with MFC or Qt, and also familiar with JUCE, you may consider to port the MFC or Qt code to JUCE. It should be easy to port the part for displaying the chart, support clickable hot spots and tooltips and programmable track cursors. The "zooming and scrolling" support takes more work to port. The ViewPortControl is the more complicated part.

Regards
Peter Kwan

  Re: Using the ChartDirector and JUCE Gui program
Posted by Per-Erik Jansson on Jun-04-2019 16:22
Hi Peter,
Thanks for your response.
I have now made a quick test and it works well to use the ChartDirector library
together with the JUCE package that is actually branch from the previous Qt.
As long I am working on a Windows system if looks great.


The JUCE is platform independent and makes it also attractive since
the code is mostly modern C++ based and have many great options compared to
the use of Windows with MFC


Integration to there system can be made by creating an function for
a ChartDirector using the output from makechart.


I will explore later on how to make use of zoom options and the
viewport management. The Juce have also functions for viewport and
listners for objects created. So interaction from your program to
the design of the interface is nice in my view.


An issue how to run the code now on platsforms like android and Unix.

Do I need new version of the Chartdirector Dll for each of the systems.

I like the Chartdirector but I miss the opensource approach and making all
the code available like the JUCE project.

An integration with the JUCE system would be the best.

Do you have plans for such a development. It would in my view make
the Chartdirector more useful for program development in general. ?




Image GetDirectorImage(size_t choice) {

// The data for the bar chart

double data[] = { 85, 156, 179.5, 211, 123 };

if (choice > 1) data[2] = 20.;

// The labels for the bar chart
const char* labels[] = { "Mon", "Tue", "Wed", "Thu", "Fri" };

// Create a XYChart object of size 250 x 250 pixels
unique_ptr<XYChart> c = make_unique<XYChart>(250, 250);

// Set the plotarea at (30, 20) and of size 200 x 200 pixels
c->setPlotArea(30, 20, 200, 200);

// Add a bar chart layer using the given data
c->addBarLayer(DoubleArray(data, sizeof(data) / sizeof(data[0])));

// Set the labels on the x axis.
c->xAxis()->setLabels(CUtil::StringArray(labels, sizeof(labels) / sizeof(labels[0])));
auto m = c->makeChart(1);
return ImageCache::getFromMemory(m.data, m.len);

};

  Re: Using the ChartDirector and JUCE Gui program
Posted by Peter Kwan on Jun-05-2019 05:02
Hi Per-Erik,

Thanks a lot for your code and your useful feedback.

To integrate with JUCE, you just need to port the chart viewer and viewport control to use the JUCE GUI framework. In this way, ChartDirector can be used with JUCE on any platform that ChartDirector supports, including Windows, Linux and macOS. You may download them from our web site. The chart viewer and viewport control are already open source and the source code is already included in the ChartDirector downloaded.

For Android and iOS, we only have an unsupported version. The Android version is based on Java, which is the most common Android programming language. The iOS version is based on C++ with Objective C++ sample code. If you are interested, please let me know.

Regards
Peter Kwan