我正在使用Microsoft圖表控件將幾個圖表放在網頁上。如果您呈現兩個圖表,生成的HTML是這樣的(表是我的,IMG和地圖是從MS圖):同一頁上的多個MS圖表使用相同的圖像
<table id="chart">
<tr>
<td id="rolling">
<img src="/ChartImg.axd?i=chart_45ec7063132a47d9bf08ce377f4d6030_0.png&g=d82064ecb0cf459dbda23039ae0c3f70" alt="" usemap="#ImageMap" style="height:200px;width:250px;border-width:0px;" />
<map name="ImageMap" id="ImageMap">
<area shape="rect" coords="190,112,242,132" title="$321.01" alt="" />
<area shape="rect" coords="59,69,111,132" title="$1,017.92" alt="" />
<area shape="rect" coords="138,104,190,132" title="$449.04" alt="" />
<area shape="rect" coords="7,25,59,132" title="$1,714.59" alt="" />
</map>
</td>
<td id="highrisk">
<img src="/ChartImg.axd?i=chart_45ec7063132a47d9bf08ce377f4d6030_1.png&g=6f876c9016cd4b72b5ba60609b9d05ec" alt="" usemap="#ImageMap" style="height:200px;width:250px;border-width:0px;" />
<map name="ImageMap" id="ImageMap">
<area shape="rect" coords="190,128,242,132" title="41" alt="" />
<area shape="rect" coords="59,131,111,132" title="6" alt="" />
<area shape="rect" coords="138,25,190,132" title="922" alt="" />
<area shape="rect" coords="7,121,59,132" title="100" alt="" />
</map>
</td>
</tr>
</table>
注意,兩個圖表的圖像地圖使用相同的名稱每個圖表 - 「ImageMap」 - 即使它在每個元素上放置不同的標題,它也會使用後續圖表的第一個圖表中的座標。
我是否在嘗試在1頁上呈現2個圖表時出錯?有沒有解決方法?
好的,儘管我早些時候的回答和評論,我已經做了一個測試來試試這個,並且更改圖表的ID會改變地圖的ID。所以,只需找到一種方法來確保您的圖表具有不同的ID,並且您已設置。 – Dave 2011-02-16 16:29:39