Jump to content
JChartFX Community
  • 0

Click column in Gantt chart


Question

8 answers to this question

Recommended Posts

  • 0

If you are using jQuery you could use something like this

        $("#myDiv").click(function(evt) {
             if ((evt.hitType == cfx.HitType.Point) || (evt.hitType == cfx.HitType.Between)) {
                 var s = "Series " + evt.series + " Point " + evt.point;
                 if (evt.hitType == cfx.HitType.Between)
                    s += " Between";
                 alert(s);
             }
        });
 

If you are not using jQuery

var divHolder = document.getElementById('myDiv');
chart1.create(divHolder);
divHolder.onclick = doClick;

function doClick(evt)
{
    if (evt.hitType == cfx.HitType.Point)
        alert("Series " + evt.series + " Point " + evt.point);
}

Regards,

JuanC 

HighlightSample.zip

Link to post
Share on other sites
  • 0

Are you using jQuery? Note that for our data (hitType, series, etc.) to be attached correctly to the event data you need to connect to the click event slightly different whether you are using jQuery or not.

If the problem persists, please try posting a small sample that duplicates your issue, also letting us know the browsers you are using (and jQuery version if using jQuery).

JuanC

post-2107-13939743289857_thumb.jpg

Link to post
Share on other sites
  • 0

var countryName = "";

var chart1;

$(document).ready(function ($) {

chart1 = new cfx.Chart();

chart1.setGallery(cfx.Gallery.Gantt);

chart1.getView3D().setEnabled(true);

chart1.getLegendBox().setVisible(false);

var i = 0;

var j = 0;

var data = chart1.getData();

data.setSeries(1);

data.setPoints(3);

var items1 = [{

"type": "Internal",

"number": 5

}, {

"type": "Outgoing",

"number": 7

}, {

"type": "Incoming",

"number": 10

}];

chart1.setDataSource(items1);

chart1.getAllSeries().getBorder().setEffect(cfx.BorderEffect.Raised);

chart1.getAxisX().getGrids().getMajor().setVisible(false);

chart1.getAxisY().getGrids().getMajor().setVisible(false);

chart1.getAxisY().getGrids().getMinor().setVisible(false);

chart1.getAxisX().getGrids().getMinor().setVisible(false);

chart1.getAxisY().setVisible(false);

chart1.getAllSeries().getPointLabels().setVisible(true);

chart1.getView3D().setEnabled(false);

chart1.getAllSeries().setVolume(70);

chart1.getGalleryAttributes().setIntraSeriesGap(60);

chart1.create(document.getElementById('ChartDiv'));

$("#ChartDiv").click(function (evt) {

if ((evt.hitType == cfx.HitType.Point) || (evt.hitType == cfx.HitType.Between)) {

var s = "Series " + evt.series + " Point " + evt.point;

if (evt.hitType == cfx.HitType.Between)

s += " Between";

alert(s);

}

});

});

Link to post
Share on other sites

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...