Jump to content
JChartFX Community

Velrex

Members
  • Posts

    1
  • Joined

  • Last visited

  • Days Won

    2

Velrex last won the day on January 8 2015

Velrex had the most liked content!

Velrex's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. I am trying to link websites into pieces of a pie chart using the event handlers for points. Below is a sample of the code i am using. When I am running a tests on the values of the points, I get undefined values. function loadChart() { alert("loadChart function started"); chart1 = new cfx.Chart(); chart1.setGallery(cfx.Gallery.Pie); var getData = chart1.getData(); getData.setSeries(1); getData.setPoints(4); chart1.getView3D().setEnabled(true); chart1.getAllSeries().getPointLabels().setFormat("%v"); chart1.getAllSeries().getPointLabels().setVisible(true); chart1.getAllSeries().getPointLabels().setAlignment(cfx.StringAlignment.NEAR); var pie = chart1.getGalleryAttributes(); pie.setExplodingMode(cfx.ExplodingMode.All); var data1 = <?echo $data;?>; chart1.setDataSource(data1); var someVar = document.getElementById('ChartDiv1') chart1.create(someVar); someVar.onclick = doClick; alert("Chart1 created"); function doClick(evt) { alert('You clicked something'); var iPoint = 0; var iSeries = 0; if ((evt.hitType == cfx.HitType.Point) || (evt.hitType == cfx.HitType.Between)) { iPoint = evt.point; iSeries = evt.series; alert('iPoint = ' + iPoint); if (iPoint == 0) { website = "http://www.yahoo.com"; } else if (iPoint == 1) { website = "http://www.msn.com"; } else if (iPoint == 2) { website = "http://www.google.com"; } else if (iPoint == 3) { website = "http://www.apple.com"; } else if (iPoint == 4) { website = "http://www.microsoft.com"; } openWebSite(website); } else { alert("points did not work"); } } function openWebSite(website) { window.open(website); }
×
×
  • Create New...