cmb99 Posted April 25, 2014 Report Share Posted April 25, 2014 Hello, trying to set width on legend docked near bottom. setHeight working fine. thx function loadChart(titleStr) { chart1 = new cfx.Chart(); chart1.setGallery(cfx.Gallery.Bar); chart1.getView3D().setEnabled(true); var title; title = new cfx.TitleDockable(); title.setText(titleStr); chart1.getTitles().add(title); title.setPlotAreaOnly(true); var data = chart1.getData(); data.setSeries(2); data.setPoints(2); var items = [{ "Candidate": 0.49, "Competing Employees": 0.85 }]; chart1.getAxisY().getLabelsFormat().setFormat(cfx.AxisFormat.Percentage); chart1.setDataSource(items); chart1.getAxisY().setMax(1); chart1.getAxisX().setVisible(false); var allSeries = chart1.getAllSeries(); var pointLabels = allSeries.getPointLabels(); pointLabels.setVisible(true); pointLabels.setOffset("16,16"); var legend = chart1.getLegendBox() legend.setDock(cfx.DockArea.Bottom); legend.setWidth(100); } Quote Link to comment Share on other sites More sharing options...
0 cmb99 Posted April 25, 2014 Author Report Share Posted April 25, 2014 also trying to set distance between bars: chart1.getGalleryAttributes().setIntraSeriesGap(0); Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted April 25, 2014 Report Share Posted April 25, 2014 When the legend is docked at the bottom you cannot control its width, there is a property called PlotAreaOnly that controls if the legend should be restricted to the plotarea or use all the available space. You can also control the horizontal alignment using ContentLayout. To set the distance between different series in the same point, setIntraSeriesGap(0) should work, note that if you want to control the distance between different points you need to use getAllSeries().setVolume(100). If none of this seem to affect your output please try posting a link to an image and include the code used to generate such image. JuanC Quote Link to comment Share on other sites More sharing options...
0 cmb99 Posted April 25, 2014 Author Report Share Posted April 25, 2014 Hi the code is posted above. should be a complete example . . setVolume(100) makes the bars fuller but not adjacent. setIntraSeriesGap has no effect. There are two series I believe Quote Link to comment Share on other sites More sharing options...
0 cmb99 Posted April 28, 2014 Author Report Share Posted April 28, 2014 Ok, I only had one series. It works with more than one, however, only when Volume = 100. Now, I am trying to chart1.setToolTips(false), and I get "Object doesn't support property or method 'setToolTips'. Quote Link to comment Share on other sites More sharing options...
0 cmb99 Posted April 29, 2014 Author Report Share Posted April 29, 2014 ok. little-by-little, I seem to be marching forward. the command is chart1.getToolTips().setEnabled(false) now I am trying to introduce a line break into the chart title. this does not seem to work: var title = new cfx.TitleDockable(); title.setText("First line \n Second line"); chart1.getTitles().add(title); Quote Link to comment Share on other sites More sharing options...
0 cmb99 Posted May 6, 2014 Author Report Share Posted May 6, 2014 Ok. I see now you have to add multiple titles to get line breaks. Next item. multiple series with setColor for each one. I thought that this example would create two series, but apparently not ? var chart1; chart1 = new cfx.Chart(); chart1.setGallery(cfx.Gallery.Bar); chart1.getView3D().setEnabled(true); var items = [ {"Group" : "Candidate Score", "Value": 0.49}, {"Group" : "Other Candidates Score", "Value" : 0.85} ]; chart1.getAxisY().getLabelsFormat().setFormat(cfx.AxisFormat.Percentage); chart1.setDataSource(items); chart1.getGalleryAttributes().setIntraSeriesGap(0); chart1.getAxisY().setMax(1); var allSeries = chart1.getAllSeries(); allSeries.setVolume(100); var divHolder = document.getElementById(divId); chart1.create(divHolder); Quote Link to comment Share on other sites More sharing options...
Question
cmb99
Hello, trying to set width on legend docked near bottom. setHeight working fine.
thx
chart1 = new cfx.Chart();
chart1.setGallery(cfx.Gallery.Bar);
chart1.getView3D().setEnabled(true);
var title;
title = new cfx.TitleDockable();
title.setText(titleStr);
chart1.getTitles().add(title);
title.setPlotAreaOnly(true);
var data = chart1.getData();
data.setSeries(2);
data.setPoints(2);
var items = [{
"Candidate": 0.49,
"Competing Employees": 0.85
}];
chart1.getAxisY().getLabelsFormat().setFormat(cfx.AxisFormat.Percentage);
chart1.setDataSource(items);
chart1.getAxisY().setMax(1);
chart1.getAxisX().setVisible(false);
var allSeries = chart1.getAllSeries();
var pointLabels = allSeries.getPointLabels();
pointLabels.setVisible(true);
pointLabels.setOffset("16,16");
var legend = chart1.getLegendBox()
legend.setDock(cfx.DockArea.Bottom);
legend.setWidth(100);
}
Link to comment
Share on other sites
6 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.