javascript - Is it possible to define an image map area by radial coordinates? -


i familiar online imagemap generators use in html pages. convenient when creating rectangular or circular areas.

however, if area pie-shaped, makes things little more complicated. example, if have shape , wanted make each pie slice separate area, image map code looks when use online imagemap generator.

<img src="url/to/your/image.jpg" alt="" usemap="#map" /> <map name="map" id="map">     <area alt="slice1" title="slice1" href="#" shape="poly" coords="149,2,146,294,40,250,4,172,14,85,73,23" />     <area alt="slice2" title="slice2" href="#" shape="poly" coords="153,1,251,38,286,86,299,148,287,207,244,264,206,283,155,295" /> </map> 

pie chart

this downside when you're using rectangular coordinates on circular shape: takes more points define pie slice need radial coordinates. example define pie slice (center x, center y, radius, angle start, angle end).

is there way define area radial coordinates, or not possible in html? read shape="circle" used genuine circle , not parts of circle.

i'm prepared accept answer of, "no it's not possible in html." if case, there alternate means of achieving same result on html page?

do need use image map. can use point.events in highchart settings detect click , redirect user window.location. wrote code output console onclick instead of redirecting. (sorry elaborate demo, picked 1 of highchart demos instead of starting scratch.)

$(function() {    $('#container').highcharts({      chart: {        plotbackgroundcolor: null,        plotborderwidth: null,        plotshadow: false,        type: 'pie'      },      title: {        text: 'browser market shares january, 2015 may, 2015'      },      tooltip: {        pointformat: '{series.name}: <b>{point.percentage:.1f}%</b>'      },      plotoptions: {        pie: {          allowpointselect: true,          cursor: 'pointer',          datalabels: {            enabled: true,            format: '<b>{point.name}</b>: {point.percentage:.1f} %',            style: {              color: (highcharts.theme && highcharts.theme.contrasttextcolor) || 'black'            }          }        }      },      series: [{        name: 'brands',        point: {          events: {            click: function() {              //location.href = this.options.url;              console.log(this.options.url);            }          }        },        colorbypoint: true,        data: [{          name: 'microsoft internet explorer',          y: 56.33,          url: "http://www.example.com/ie"        }, {          name: 'chrome',          y: 24.03,          sliced: true,          selected: true,          url: "http://www.example.com/chrome"        }, {          name: 'firefox',          y: 10.38,          url: "http://www.example.com/firefox"        }, {          name: 'safari',          y: 4.77,          url: "http://www.example.com/safari"        }, {          name: 'opera',          y: 0.91,          url: "http://www.example.com/opera"        }, {          name: 'proprietary or undetectable',          y: 0.2,          url: "http://www.example.com/other"        }]      }]    });  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <script src="https://code.highcharts.com/highcharts.js"></script>  <script src="https://code.highcharts.com/modules/exporting.js"></script>    <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -