[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: How to Draw a Chart Just Once?


  • Date: Wed, 09 Dec 2009 14:58:47 -0000
  • From: "jooleanlogic" <jooleanl@xxxxxxxxxxx>
  • Subject: [amibroker] Re: How to Draw a Chart Just Once?

PureBytes Links

Trading Reference Links

I don't think it's possible progster as it re-renders the image each update.
I have a feeling with requestTimedRefresh that irrespective of what you request, it refreshes at least at the speed set in preferences. So if you've got it set to 1 second in the prefs, then all charts will update every second. You'd need to set a long interval in prefs and then use requestTimedRefresh with shorter intervals on all your other charts.
If the image is not going to change at all, can you just screen grab or export the chart to image?

Another possibly more practical option is to process the data once and then store it all in static vars. Then all you need to do each update is render the screen from those static vars.

For example, I calculate volume profiles from tick data which can take a few seconds. But I only do this once when a ParamToggle button is pressed. It does the processing and then I store all necessary data in static vars or to file. Then I have another procedure that is called every update that renders the profiles purely from the static vars using gfx which takes no time at all.

Regards,
Jules.


--- In amibroker@xxxxxxxxxxxxxxx, "progster01" <progster@xxx> wrote:
>
> Hi.
> 
> I'm working a new-to-me corner of the AB universe lately, and I'm having an issue that I don't yet know a solution for.  Perhaps someone else has been here before and can point me in the right direction.
> 
> I've created a complex chart that requires alot of CPU to calculate and draw.
> 
> Using _TRACE() I can see that the chart code is executing approximately once per second.  The effect of this is to tie up the CPU.
> 
> The nature of this chart is such that I only need to draw it once and I am not interested in updating it a) on every tick, or b) every second.
> 
> IOW, I'd basically be satisfied to draw this chart once when I apply the AFL to the pane.  (Secondarily, I might want to add a manual refresh button, but that's beside the point at the moment.)
> 
> I have tried to put the entire code in a Status() condition like so:
> 
> RequestTimedRefresh( 20, onlyvisible = True ) ;		//	trying to reduce CPU load, but this does not stop the "regular" refresh
> 
> RAS = Status( "redrawaction" ) ; // 1 if a timed refresh, else 0
> if( RAS == 1 ){
>    <Complex code here>
> }
> 
> The goal here is to prevent any "automatic" refreshes, and allow me to specify a (much less frequent) TimedRefresh.
> 
> What I observe to happen in this case is that the chart paints (quickly) at the TimedRefresh frequency, then disappears (goes blank, to the background color) until the next TimedRefresh.
> 
> So, I'm currently stuck at either seeing the chart and paying the price for constant refreshes, or having a flashing/disappearing chart which is useless (but cheap!).
> 
> Thus the question, in a nutshell:
> 
>    How to Draw a Chart Just Once?
> 
> (and not have it disappear on you).
> 
> Thanks to anyone who can shed some light on this for me!
>




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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/