Jump to content
JChartFX Community
  • 0

Event handler will not detect points/series


Velrex

Question

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) {
}
else if (iPoint == 1) {
}
else if (iPoint == 2) {
}
else if (iPoint == 3) {
}
else if (iPoint == 4) {
}
openWebSite(website);
}
else
{
alert("points did not work");
}
 
}

 

function openWebSite(website)
 {
window.open(website);
 }
  • Like 2
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...