var chart1 = new cfx.Chart(); var strTitle = "my sample" chart1.setGallery(cfx.Gallery.Pie); chart1.getAllSeries().getPointLabels().setVisible(true); var pie = chart1.getGalleryAttributes(); pie.setExplodingMode(cfx.ExplodingMode.All);
PopulateData(chart1); var fields = chart1.getDataSourceSettings().getFields();
var field1 = new cfx.FieldMap(); field1.setName("Region"); field1.setUsage(cfx.FieldUsage.RowHeading); fields.add(field1);
var field2 = new cfx.FieldMap(); field2.setName("keyFigure"); field2.setUsage(cfx.FieldUsage.ColumnHeading); fields.add(field2);
var fieldVal = new cfx.FieldMap(); fieldVal.setName("Usage"); fieldVal.setUsage(cfx.FieldUsage.Value); fields.add(fieldVal);
var crosstab = new cfx.data.CrosstabDataProvider(); crosstab.setDataSource(chart1.getDataSource()); chart1.setDataSource(crosstab);
var data = chart1.getData(); data.setSeries(1);
var titles = chart1.getTitles(); var title = new cfx.TitleDockable(); title.setText(strTitle); titles.add(title);
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.
Question
Janusz
Hi,
i tried to add "onClick" on a pie chart, like you described:
$("#myjChartFX").click(function (evt) {
if (evt.hitType == cfx.HitType.Point)
alert("Series " + evt.series + " Point " + evt.point);
});
i'm using:
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui.min.js"></script>
<script type="text/javascript" src="./Resources/jchartfx.system.js"></script>
<script type="text/javascript" src="./Resources/jchartfx.coreVector.js"></script>
<script type="text/javascript" src="./Resources/jchartfx.advanced.js"></script>
<script type="text/javascript" src="./Resources/jchartfx.animation.js"></script>
<script type="text/javascript" src="./Resources/jchartfx.userInterface.js"></script>
unfortunately the evt.hitType is 0 and cfx.HitType.Point is 4. And also the evt.series and evt.point are undefined.
I'm using your sample from the dowload zip with pie samples.
i also tried to use the
<script type="text/javascript" src="./resources/jquery-1.7.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="http://www.jchartfx.com/libs/v7/current/js/jchartfx.full.js"></script>
same result.
my js:
var chart1 = new cfx.Chart();
var strTitle = "my sample"
chart1.setGallery(cfx.Gallery.Pie);
chart1.getAllSeries().getPointLabels().setVisible(true);
var pie = chart1.getGalleryAttributes();
pie.setExplodingMode(cfx.ExplodingMode.All);
PopulateData(chart1);
var fields = chart1.getDataSourceSettings().getFields();
var field1 = new cfx.FieldMap();
field1.setName("Region");
field1.setUsage(cfx.FieldUsage.RowHeading);
fields.add(field1);
var field2 = new cfx.FieldMap();
field2.setName("keyFigure");
field2.setUsage(cfx.FieldUsage.ColumnHeading);
fields.add(field2);
var fieldVal = new cfx.FieldMap();
fieldVal.setName("Usage");
fieldVal.setUsage(cfx.FieldUsage.Value);
fields.add(fieldVal);
var crosstab = new cfx.data.CrosstabDataProvider();
crosstab.setDataSource(chart1.getDataSource());
chart1.setDataSource(crosstab);
var data = chart1.getData();
data.setSeries(1);
var titles = chart1.getTitles();
var title = new cfx.TitleDockable();
title.setText(strTitle);
titles.add(title);
chart1.getAllSeries().getPointLabels().setVisible(true);
chart1.getAllSeries().getPointLabels().setAlignment(cfx.StringAlignment.NEAR);
chart1.getAnimations().getLoad().setEnabled(true);
chart1.create("myjChartFX");
i'll be grateful for any help :-)
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
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.