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

Message ListMessage List     Post MessagePost Message

  resizing & initializing & reinitialize graph for all window/area`s width
Posted by Yuriy on Jun-23-2016 03:37
Hi,
I try to use the chart "Finance Charts" for drawing my data.
The width of the window to embed graphics = 1000px
The number of points on the axis X = 10.
As a result, I get that the graph covers the area to the left - not all of 1000px.

1. How can I tell the graph to rendered the entire width of the window automatically?
2. At the time of changing the window size remains the same schedule. The use of call "drawChart" allow me to proportionally increase or decrease the size of my schedule without creating other graph object?
3. If I want to add one more point (eleventh), is there a method to do this without creating a different graph object?

Thanks.
Yuriy.

  Re: resizing & initializing & reinitialize graph for all window/area`s width
Posted by Peter Kwan on Jun-25-2016 05:36
Attachments:
Hi Yurly,

If you provide 10 visible trading sessions of data, the FinanceChart should show 10 sessions and this should occur the entire plot area. I have attached an example on what it should look like for your reference.

For your case, would you mind to inform me which programming language edition of ChartDirector you are using, and if you are writing a web or desktop application. Also, if your code is based on the ChartDirector sample code, please let me know which sample code you are using.

Note that in the "Interactive Financial Chart" sample code, if it is an intraday chart, the sample code will extend the x-axis to the whole day, even if the actual data are just for a few minutes. If you do not want the chart to be extended to the whole day, please simply remove the part of the sample code that extends the timestamps to the whole day.

For resizing or adding data to the chart, in ChartDirector, you would need to redraw the chart by creating another chart object. Note that creating another chart object takes negligible time and do not need any extra code (since you already have the code to create the chart object in the first place). So this is the simple and efficient method.

(The part that uses CPU time is to update the display, not in creating the chart object. Even if your code does not need to recreate the chart object, the display still needs to be update if anything is changed, so it will not save any significant CPU time. In contrast, if we create the chart object, it does not need any extra code as you can use the same code that draw the chart in the first place. So it is the easiest method.)

You can try the zooming and scrolling sample code and the realtime chart sample code. In these sample code, the chart object is recreated everything the chart zoom/scrolls or a new data point comes in. You can see the chart runs quite smoothly and so creating new chart objects do not really have any significant overhead.

Regards
Peter Kwan
finance2.png

  Re: resizing & initializing & reinitialize graph for all window/area`s width
Posted by Yuriy on Jun-27-2016 16:31
Attachments:
Thank you for detailed answer.
Help me please with another questions about this kind of graphics:
1. How can I control visibility and color the graphs grid lines?
2. What is the function controls the smoothness of line graphics (anti-aliasing) and how to use it (link to faq...)?
3. How to make a smooth "addAreaLayer" such as "addSplineLayer" (combined together those areas capabilities)?

Thank you
Yuriy
2016-06-27_113114.png

  Re: resizing & initializing & reinitialize graph for all window/area`s width
Posted by Peter Kwan on Jun-28-2016 04:55
Hi Yuriy,

1. I think currently your code sets the grid line color to white (possibly in XYChart.setPlotArea or in PlotArea.setGridColor). To change the grid line color, please modify your code to set another color. To hide the grid lines, please set the color to Transparent.

2. All graphics by default are anti-aliased. (The PNG image you attached in your message looks "pixelated" because you may have use another software to view the image not in its normal size. For example, if you create an image with 300 x 200 pixels, but view it as 640 x 480 pixels, the image may look pixelated. If you want to have a large image, make sure your code creates a larger image.)

To control the anti-alias, the API is BaseChart.setAntiAlias.

3. Please add a spline layer, then use an "Interline Layer" (addInterLineLayer) to fill the region between the spline layer and the x-axis. See the sample code "Inter-Line Coloring" for an example that uses addSplineLayer with addInterLineLayer.

Hope this can help.

Regards
Peter Kwan

  Re: resizing & initializing & reinitialize graph for all window/area`s width
Posted by Yuriy on Jul-04-2016 15:38
Help me please with another question,

When I change viewport size or place, I need to process the end of changes. What function or handler should I use?
(My processing will be a few seconds long, that`s why I need only the end of changes to proccess).

thanks.
Yuriy.

  Re: resizing & initializing & reinitialize graph for all window/area`s width
Posted by Peter Kwan on Jul-05-2016 00:33
Hi Yuriy,

I am not too sure which programming language you are using and whether you are writing a web or desktop application. I assume it is a web application.

In the sample code, such as in the "Zooming and Scrolling" examples or in the "when the viewport is changed", the chart will display a "rotating icon" with the text "Updating" until the updated chart is received. In the "Zooming and Scrolling with Track Line (Web)", there is also a "PreUpdate" event handler to perform something just before the update request is sent to the server.

If you want to do something after the updated chart have been received, you can use a "PostUpdate" event handler. The code is the same as the "PreUpdate" event handler in the sample code, except that you change the "PreUpdate" to "PostUpdate".

Hope this can help.

Regards
Peter Kwan