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

Message ListMessage List     Post MessagePost Message

  Click drag and zoom
Posted by Sanjay on Nov-13-2004 21:10
Hi Peter,

What would be the best way to "zoom in" into a more detail chart. For example: in 1 year finance chart (where it's showing HLOC chart), I want to click and drag some areas in the middle of the chart (the area that is clicked and dragged will be highlighted), and when I release the mouse button the chart will "zoom in" the area that are highlighted.
The problem is, how do I highlight the area while clicking and dragging? and how do I detect the starting date and the ending date in the highlighted area?

I'm developing using VB .Net.

Thanks,
Sanjay.

Note:
To give you an idea, try this url: (try to click and drag in the middle of the chart to zoom in)

http://bigcharts.marketwatch.com/javachart/javachart.asp?symb=msft&time=&freq=

  Re: Click drag and zoom
Posted by Peter Kwan on Nov-14-2004 00:01
Hi Sanjay,

I assume you are writing a web application. For a web application, it may be non-trivial to achieve "click grad and zoom" unless you are using Java Applets or download ActiveX controls on the client side. For example, the link you mention is based on Java Applets.

ChartDirector web charts are not based on applets. It is just based on standard images. The advantages are that ChartDirector charts can be viewed in almost all browsers, and it works in secure environments (where Java is typically disabled), and it also works with mobile computing devices or even mobile phones, and the charts can be cut and paste to clipboard, imported to MS Word, email programs, etc..

I am not if you can mark the regions during click and drag with a browser without using Java Applets or ActiveX controls. I have not tried myself, but I think it may be possible for some kind of marking (eg. just draw a rectangle) by using client side Javascript.

By using client side Javascript, you can get the mouse coordinates in pixels. You also know the scale of the axis (can be retrieved using Axis.getMaxValue and Axis.getMinValue), so you can include these values in your web page and make them readable by your client side Javascript. So your client side Javascript should have sufficient information to determine the date range that the user has selected. It can then reload the chart image and include the date range in the URL parameters, so the server can generate another chart with the proper date range.

As you can see, since ChartDirector does not use Java Applets or need to install ActiveX controls on the client side, all user interactions need to be achieved by writing client side Javascript.

Regards
Peter Kwan

  Re: Click drag and zoom
Posted by Sanjay on Nov-16-2004 04:35
Sorry I forgot to mention the environment I'm using.

I'm trying to do this using "Windows Form" (Visual Studio .NET 2003 - VB Net), which I think makes this a little "easier" rather than Web environment, since you can easily detect mouse coordinates while you're moving the mouse. I'm not planning to develop this using web environment due to the limited number of users that are going to use this app. (only 2 users).

In this case, what would be your suggestion Peter?

Thanks again,

Sanjay.

  Re: Click drag and zoom
Posted by Peter Kwan on Nov-16-2004 06:21
Hi Sanjay,

For a Windows Form, I think the method is similar. When the user clicks and drags, you can use the standard mouse events to get the mouse coordinates. Then you can draw a semi-transparent rectangle on top of the Form for highlighting, or just to put a semi-tranparent control on the Form (which will therefore be on top of the chart) for highlighting. I think MSDN has some examples on how to draw a rectangle and create a semi-transparent control in .NET.

Also, once you know the mouse coordinates, you can convert it to data coordinates (the date range). It is because your code knows the axis scale. (For the x-axis, both the axis labels and the axis positions come from your code.) Once you know the date range, you can zoom into that date range.

In some sense, the above is even better than the sample link you show in the earlier message. The sample link is just doing a "graphical zoom", but not a "data zoom". For example, in the link, one cannot zoom from a daily chart to a hourly chart. (If initially the chart is a daily chart showing say 200 days, even if you zoom to 1 day, it is still a daily chart showing 1 day as a single bar, instead of zooming into the day by showing data in 15 minutes interval.) However, using the above method, this can be achieved.

Regards
Peter Kwan

  Re: Click drag and zoom
Posted by Sanjay on Nov-16-2004 21:17
Thanks for the idea Peter, I will give it a try!

Sanjay.

  Re: Click drag and zoom
Posted by Mog Obahor on Aug-09-2011 07:16
Hi Sanjay,

I am trying to implement something similar like you have in the past.  Interfacing Visual C++ and VB to create graphical windows where I can zoom in the datasets.
If you can send me a sample code. I am considering whether it is viable to purchase the ChartDirector to do what I want to do.
Basically, I am trying to plot 2D and 3D data.  I want to be able to zoom in closely just like in other graphical packages like Matlab.

Please advise. You can also reach me at obahor@gmail.com
-Mog

  Re: Click drag and zoom
Posted by Peter Kwan on Aug-10-2011 01:04
Hi Mog,

The current version of ChartDirector already contains sample code for zoomable charts.

For standard C++, the "ChartDirector for C++ for Windows" includes Visual Studio sample projects. You may open them by opening the Visual Studio solution file at "ChartDirector\\mfcdemo\\mfcdemo.dsw" (for the 32-bit edition) or "ChartDirector\\mfcdemo\\mfcdemo.sln" (for the 64-bit edition). This will open several Visual Studio projects, two of them are for "Zoomable and Scrollable Charts".

For VB, I am not sure if you are referring to classical VB (like VB 6, VBScript or VBA), or .NET based VB (like VB.NET, VB 2005, VB 2008, VB 2010). For .NET based VB, you may use "ChartDirector for .NET". The Visual Studio sample solution will be installed at "c:\\Program Files\\ChartDirector\\NetWinCharts".

Hope this can help.

Regards
Peter Kwan

  QT example
Posted by Mog Obahor on Aug-16-2011 00:05
Hi there,

Can you let me know where I can find an example of how to run the QT demo of ChartDirector.  Just wanted to test it
to see if it is going to be able to do the functions I require.

Regards,
Mog

  Re: QT example
Posted by Peter Kwan on Aug-16-2011 03:12
Hi Mog,

ChartDirector for C++ also include sample code using the QT GUI framework. (ChartDirector for C++ is GUI framework neutral and works with all GUI framework. We include sample code for the MFC framework and QT framework just as examples.)

The details step on how to compile and run the QT sample code is described in the "ChartDirector Documentation/Installation/Using ChartDirector with QT". In general, the sample code comes with standard QT project files. You just need to open or make the project file using the QT development tools you have. The exact steps depend on which QT development tool you are using. For example, the steps for the Visual Studio QT plug will be different from QT Creator, which will be different from qmake/gcc/g++ or qmake/XCode.

If you need further help, would you mind to inform me which QT development tool and which OS you are using?

Regards
Peter Kwan

  Re: QT example
Posted by Mog on Aug-19-2011 00:51
I am currently planning on using Visual Studio 2008 for my development environment.  Did you say there is a QT Visual Studio Plugin.  If so, how do I go about setting that up.

Please advise
Regards,
Mog

  Re: QT example
Posted by Peter Kwan on Aug-19-2011 01:34
Hi Mog,

The QT Visual Stuido Plugin can be downloaded from the official QT download site. See:

http://qt.nokia.com/downloads/downloads

(The QT Visual Stuido Plugin is near the bottom of the above download page. Please refer to QT documentation on how to install and use it.)

Hope this can help.

Regards
Peter Kwan

  Re: QT example
Posted by Mog on Aug-19-2011 02:00
Thanks peter for the prompt response to my question.

Now I need to know what version do I need to install
1. Qt libraries 4.7.3 for Windows (VS 2008, 228 MB)
OR
2. Qt libraries 4.6.4 for Windows (VS 2008)

Thanks,
Mog

  Using VS2008 to open ".pro" QT project filew
Posted by Mog on Aug-19-2011 04:14
In the documentation it says that "The QT ".pro" project files can be opened directly with the QT Creator or the Visual Studio QT Plug-in."

I installed the necessary add-in for Visual Studio.  Can you please link me to instructions on how to go about compiling the helloworld via Visual Studio 2008.

Thanks.

Mog

  Re: Using VS2008 to open ".pro" QT project filew
Posted by Peter Kwan on Aug-19-2011 23:40
Hi Mog,

You just need to open the QT "Hello World" project file with the Visual Studio QT plug-in, and press the run button.

If you are not familiar with how to use QT or the Visual Studio QT plug-in, you may refer to QT documentation. For example, the following page mentions how to open a QT project file with the Visual Studio QT plug-in:

http://doc.qt.nokia.com/vs-add-in-1.1.7/vs-addin-managing-projects.html

Hope this can help.

Regards
Peter Kwan

  Re: Using VS2008 to open ".pro" QT project filew
Posted by Mog on Aug-23-2011 06:28
Attachments:
Thank you Peter. I was able to get the QT plugin setup and configured for MSVC2008.
but what I am not sure about is how to add the library into Visual 2008 environment so that it can call the "chartdir50.lib" library files.

This is the error I am getting below when I compile:
1>------ Build started: Project: helloworld, Configuration: Debug Win32 ------
1>Moc'ing qchartviewer.h...
1>Compiling...
1>moc_qchartviewer.cpp
1>qchartviewer.cpp
1>helloworld.cpp
1>c:\\qt\\4.7.3\\examples\\helloworld\\generatedfiles\\debug\\../../qchartviewer.h(5) : fatal error C1083: Cannot open include file: 'chartdir.h': No such file or directory
1>c:\\qt\\4.7.3\\examples\\helloworld\\qchartviewer.h(5) : fatal error C1083: Cannot open include file: 'chartdir.h': No such file or directory
1>c:\\qt\\4.7.3\\examples\\helloworld\\qchartviewer.h(5) : fatal error C1083: Cannot open include file: 'chartdir.h': No such file or directory
1>Build log was saved at "file://c:\\Qt\\4.7.3\\examples\\helloworld\\tmp\\obj\\debug_shared\\BuildLog.htm"
1>helloworld - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
helloworld_printscreen.JPG
msvc2008_ide_env.JPG

  Re: Using VS2008 to open ".pro" QT project filew
Posted by Mog on Aug-23-2011 08:03
when I include the chart50.lib file in the library path.  The errors below are what I get. How do I resolve that?

1>------ Build started: Project: helloworld, Configuration: Debug Win32 ------
1>Linking...
1>helloworld.obj : error LNK2019: unresolved external symbol _CBaseChart_getHTMLImageMap referenced in function "public: char const * __thiscall BaseChart::getHTMLImageMap(char const *,char const *,char const *,int,int)" (?getHTMLImageMap@BaseChart@@QAEPBDPBD00HH@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _CAxis_setLabels referenced in function "public: class TextBox * __thiscall Axis::setLabels(class StringArray)" (?setLabels@Axis@@QAEPAVTextBox@@VStringArray@@@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _TextBox2Box referenced in function "public: __thiscall TextBox::TextBox(class TextBoxInternal *)" (??0TextBox@@QAE@PAVTextBoxInternal@@@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _Box2DrawObj referenced in function "public: __thiscall Box::Box(class BoxInternal *)" (??0Box@@QAE@PAVBoxInternal@@@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _XYChart2BaseChart referenced in function "public: __thiscall XYChart::XYChart(int,int,int,int,int)" (??0XYChart@@QAE@HHHHH@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _CXYChart_create referenced in function "public: __thiscall XYChart::XYChart(int,int,int,int,int)" (??0XYChart@@QAE@HHHHH@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _CBaseChart_destroy referenced in function "public: virtual __thiscall BaseChart::~BaseChart(void)" (??1BaseChart@@UAE@XZ)
1>helloworld.obj : error LNK2019: unresolved external symbol _CXYChart_xAxis referenced in function "public: class Axis * __thiscall XYChart::xAxis(void)" (?xAxis@XYChart@@QAEPAVAxis@@XZ)
1>helloworld.obj : error LNK2019: unresolved external symbol _CXYChart_setPlotArea referenced in function "public: class PlotArea * __thiscall XYChart::setPlotArea(int,int,int,int,int,int,int,int,int)" (?setPlotArea@XYChart@@QAEPAVPlotArea@@HHHHHHHHH@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _CXYChart_addBarLayer referenced in function "public: class BarLayer * __thiscall XYChart::addBarLayer(class DoubleArray,int,char const *,int)" (?addBarLayer@XYChart@@QAEPAVBarLayer@@VDoubleArray@@HPBDH@Z)
1>helloworld.obj : error LNK2019: unresolved external symbol _BarLayer2Layer referenced in function "public: __thiscall BarLayer::BarLayer(class BarLayerInternal *)" (??0BarLayer@@QAE@PAVBarLayerInternal@@@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_create referenced in function "public: __thiscall ViewPortManager::ViewPortManager(void)" (??0ViewPortManager@@QAE@XZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_destroy referenced in function "public: __thiscall ViewPortManager::~ViewPortManager(void)" (??1ViewPortManager@@QAE@XZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CImageMapHandler_destroy referenced in function "public: __thiscall ImageMapHandler::~ImageMapHandler(void)" (??1ImageMapHandler@@QAE@XZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CImageMapHandler_getHotSpot referenced in function "public: int __thiscall ImageMapHandler::getHotSpot(int,int)" (?getHotSpot@ImageMapHandler@@QAEHHH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CImageMapHandler_getValue referenced in function "public: char const * __thiscall ImageMapHandler::getValue(char const *)" (?getValue@ImageMapHandler@@QAEPBDPBD@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_inPlotArea referenced in function "public: bool __thiscall ViewPortManager::inPlotArea(int,int)" (?inPlotArea@ViewPortManager@@QAE_NHH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_canZoomIn referenced in function "public: bool __thiscall ViewPortManager::canZoomIn(int)" (?canZoomIn@ViewPortManager@@QAE_NH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_canZoomOut referenced in function "public: bool __thiscall ViewPortManager::canZoomOut(int)" (?canZoomOut@ViewPortManager@@QAE_NH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_startDrag referenced in function "public: void __thiscall ViewPortManager::startDrag(void)" (?startDrag@ViewPortManager@@QAEXXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_zoomAt referenced in function "public: bool __thiscall ViewPortManager::zoomAt(int,int,int,double)" (?zoomAt@ViewPortManager@@QAE_NHHHN@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_zoomTo referenced in function "public: bool __thiscall ViewPortManager::zoomTo(int,int,int,int,int)" (?zoomTo@ViewPortManager@@QAE_NHHHHH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CBaseChart_getWidth referenced in function "public: int __thiscall BaseChart::getWidth(void)const " (?getWidth@BaseChart@@QBEHXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CBaseChart_getHeight referenced in function "public: int __thiscall BaseChart::getHeight(void)const " (?getHeight@BaseChart@@QBEHXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CBaseChart_makeChart2 referenced in function "public: bool __thiscall BaseChart::makeChart(int,char const * *,int *)" (?makeChart@BaseChart@@QAE_NHPAPBDPAH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CBaseChart_getChartMetrics referenced in function "public: char const * __thiscall BaseChart::getChartMetrics(void)" (?getChartMetrics@BaseChart@@QAEPBDXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_setChartMetrics referenced in function "public: void __thiscall ViewPortManager::setChartMetrics(char const *)" (?setChartMetrics@ViewPortManager@@QAEXPBD@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CImageMapHandler_create referenced in function "public: __thiscall ImageMapHandler::ImageMapHandler(char const *)" (??0ImageMapHandler@@QAE@PBD@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_getPlotAreaLeft referenced in function "public: int __thiscall ViewPortManager::getPlotAreaLeft(void)" (?getPlotAreaLeft@ViewPortManager@@QAEHXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_getPlotAreaTop referenced in function "public: int __thiscall ViewPortManager::getPlotAreaTop(void)" (?getPlotAreaTop@ViewPortManager@@QAEHXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_getPlotAreaWidth referenced in function "public: int __thiscall ViewPortManager::getPlotAreaWidth(void)" (?getPlotAreaWidth@ViewPortManager@@QAEHXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_getPlotAreaHeight referenced in function "public: int __thiscall ViewPortManager::getPlotAreaHeight(void)" (?getPlotAreaHeight@ViewPortManager@@QAEHXZ)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_dragTo referenced in function "public: bool __thiscall ViewPortManager::dragTo(int,int,int)" (?dragTo@ViewPortManager@@QAE_NHHH@Z)
1>qchartviewer.obj : error LNK2019: unresolved external symbol _CViewPortManager_validateViewPort referenced in function "public: void __thiscall ViewPortManager::validateViewPort(void)" (?validateViewPort@ViewPortManager@@QAEXXZ)
1>debug\\helloworld.exe : fatal error LNK1120: 34 unresolved externals
1>Build log was saved at "file://c:\\Qt\\4.7.3\\examples\\helloworld\\tmp\\obj\\debug_shared\\BuildLog.htm"
1>helloworld - 35 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  Re: Using VS2008 to open ".pro" QT project filew
Posted by Peter Kwan on Aug-24-2011 02:13
Hi Mog,

Since you obtained linker errors, it means you had already successfully compiled the code, and therefore the include file worked.

The linker error means the linker cannot find a suitable chartdir50.lib.

From your other thread, you seem to be using the 64-bit edition of ChartDirector with the 32-bit edition of QT. This may explain why linking failed. If this is the cause of the problem, please use the 32-bit edition of ChartDirector instead.

Another possible reason is that the path to "chartdir50.lib" is not set correctly. Are you sure the path to "chartdir50.lib" is correct?

Regards
Peter Kwan

  Re: Using VS2008 to open ".pro" QT project filew
Posted by Mog on Aug-24-2011 02:45
Hi Peter,

Thank you very much it worked.  My question is whether there is a 64 bit version of QT out there.

Regards,
Mog

  Re: Using VS2008 to open ".pro" QT project filew
Posted by Peter Kwan on Aug-25-2011 00:10
Hi Mog,

Note that QT is not our product. It is a product from Nokia. You may want to send your enquiry to Nokia for the official answer.

As far as I know, there is no official compiled 64-bit QT on Windows. But as QT is open source, you can always compile it yourself. (Again, please send your enquiry to Nokia for the official answer.)

Hope this can help.

Regards
Peter Kwan