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

Message ListMessage List     Post MessagePost Message

  partialUpdateChart() and AreaMap
Posted by mephy on May-07-2015 17:01
Attachments:
Hello.

I'm making scroll chart with trackLine feature.
Scroll event set on button click, buttons are on the chart.

First load everything works fine - buttons/areamap working, they can be pushed.
When I click a button - chart reloads, and only track line works.

Looks like areamap is missing (no "hand" cursor on buttons, I cant click)
When I click anywhere on chart areamap start working, and I can click on buttons.

Aremap somehow dont attach to <IMG> before mouse click?
I think I can simulate mouse click on chart by js, but maybe another solution?

Some code:
// chart load first time
<?php echo $viewer->renderHTML("usemap='#map1'")?>

//js events
viewer.attachHandler("ViewPortChanged", viewer.partialUpdate);
viewer.attachHandler("MouseMovePlotArea", function(e) {
        trackLineLabel(viewer, viewer.getPlotAreaMouseX());
        viewer.setAutoHide("all", "MouseOutPlotArea");
    });

//js for reload
[.. calc and set viewpointer left and width ..]
    viewer.raiseViewPortChangedEvent();

//php for reload
if ($viewer->isPartialUpdateRequest()) {
    # Is a partial update request. Draw the chart and perform a partial response.

    drawChart($viewer);
    print($viewer->partialUpdateChart());
    exit();
}
chart.png

  Re: partialUpdateChart() and AreaMap
Posted by mephy on May-07-2015 17:11
Oh, found something.

Before mouse click attr usemap = 'null'.
Afret click it sets to usemap = '#map1'.

  Re: partialUpdateChart() and AreaMap
Posted by Peter Kwan on May-08-2015 00:59
Hi memphy,

I have just tried myself. I started with the original "Zooming and Scrolling with Track Line"
sample code, and add just one just to include the image map:

$viewer->setImageMap($c->getHTMLImageMap("aaa.php", "", "title='{value}'"));

Then I try the sample code. It works normally. The image map works without having to click
first.

For your case, is your image map managed by the WebChartViewer? If the WebChartViewer
knows there is an image map, it should generate the usemap attribute automatically, and
there is no need to add that tag to renderHTML.

There is a sample code in ChartDirector called "XY Zooming and Scrolling", which has image
map and zooming and scrolling. It demonstrates how to use image map with the
WebChartViewer.

Hope this can help.

Regards
Peter Kwan

  Re: partialUpdateChart() and AreaMap
Posted by mephy on May-08-2015 16:27
Hi, Peter!

I've done the same:
took zoomscrolltrack.php, added 3 lines:

$left = $c->addText(150, 150, "<*block*><*img=left.png*>"  );
$imageMap = "<area ".$left->getImageCoor()." href='javascript:alert(hi);' title='Back'
/>";
$viewer->setImageMap($imageMap);

And, from page load I cant click on area. ("hi" message dont appear)
- trackLine is above area map.

I've looked at my previous code, and mentioned the difference:
I use:        <map name='map_chart1'>
chart code: <map id='map_chart1' name='map_chart1'>

Somehow its ABOVE when there is no id :-)



Best regards,
mephy

  Re: partialUpdateChart() and AreaMap
Posted by mephy on May-08-2015 17:49
hm, when I delete "id" attribute from chart area map its still not working.

Is there any event after chart update is over?
So I can set my own map to the chart pic?

  Re: partialUpdateChart() and AreaMap
Posted by Peter Kwan on May-09-2015 02:40
Attachments:
Hi mephy,

To avoid uncertainties, I have attached the test code I am using. This time I am using the
exact code in your last message, except that I changed from "left.png" to "wood.png". The
latter is an image file in the original ChartDirector sample code (in the "phpdemo")
subdirectory. I also redistribute the code so that the addText code occurs before
makeSession, and the setImageMap code occurs after makeSession.

In my case, when I move the mouse over the image, it should show the "hand" cursor. Then
I go to the left side, uncheck one of the text box, and press "Update Chart". Then I move
the mouse back to the image, and there is still the "hand" cursor. I do not need to click on
the chart.

Note that the hand cursor sometimes do not appear because the mouse can be over the
track cursor line instead of the image, in which case you would be clicking on the track
cursor line, not the image. If you move the mouse slight, you should see the hand cursor.
(For this reason, if you want to insert a button in the image.)

Also, note that your original code has an error so if you click on it, nothing should occur,
but at least the "hand" cursor should work when the mouse moves over the hot spot.

Would you mind to try the code exactly as it is to see if it works in your case?

Regards
Peter Kwan
zoomscrolltrack.php
zoomscrolltrack.php

18.80 Kb

  Re: partialUpdateChart() and AreaMap
Posted by mephy on May-11-2015 16:13
Attachments:
Hi, Peter.

Thank you, your code is working.
Maybe I had some errors that time...

But, when I use my variant (own map) -
its much easier to click on button, since trackLine dont work on button area.

Attaching an example, if you're interested:
zoomscrolltrack.php +
added code:
  - renderHTML("usemap='#map1'")
  - map
  - postUpdate event + document.getElementById("chart1").setAttribute("usemap",
'#map1');
zoomscrolltrack.php

  Re: partialUpdateChart() and AreaMap
Posted by mephy on May-11-2015 16:28
Oops, sorry for spam :(