-
2 Jun 2010 2:45 PM #1
OFC / GXT stacked chart #x_label# integration bug
OFC / GXT stacked chart #x_label# integration bug
I am using GWT 1.7.1 and GXT 2.1.1
Browsers: IE8, Chrome 4.1, FF, Hosted Mode & Compiled both
OS: Win7 64-bit
Normally you can use #x_label# in your tooltip text and it will evaluate to whatever the label is on the x axis. If you call the setLabels method on the XAxis of your chart model to make these labels a little more meaningful the #x_label# keyword no longer evaluates to the appropriate value and instead appears to evaluate to an empty string. I believe this is to do with how GXT is interacting with OFC since the OFC sample on their website seems to work properly.
For the bug reproduction snippet to work you may need to change the location of the charting swf where the Chart is initialized to the location of the swf in your WebContent folder. You should be able to drop this BugReproduction layout container into an application that already is set up with charting support (ie script is in the html page and so on).
Code:import java.util.ArrayList; import java.util.List; import com.extjs.gxt.charts.client.Chart; import com.extjs.gxt.charts.client.model.ChartModel; import com.extjs.gxt.charts.client.model.axis.XAxis; import com.extjs.gxt.charts.client.model.axis.YAxis; import com.extjs.gxt.charts.client.model.charts.StackedBarChart; import com.extjs.gxt.charts.client.model.charts.StackedBarChart.StackValue; import com.extjs.gxt.ui.client.widget.LayoutContainer; import com.google.gwt.user.client.Element; public class BugReproduciton extends LayoutContainer { private final LayoutContainer chartContainer = new LayoutContainer(); public BugReproduciton() { this.add(chartContainer); } @Override protected void onRender(final Element parent, final int pos) { super.onRender(parent, pos); chartContainer.add(buildChart(true)); chartContainer.add(buildChart(false)); } private Chart buildChart(final boolean personalizedXAxis) { final Chart chart = new Chart("ExtGWT/chart/open-flash-chart.swf"); chart.setHeight(220); final StackedBarChart stackedConfig = new StackedBarChart(); stackedConfig.setTooltip("x_label = [#x_label#]"); populateStacks(stackedConfig); final ChartModel chartModel = new ChartModel(); final YAxis yAxis = new YAxis(); yAxis.setMax(2000); chartModel.setYAxis(yAxis); final XAxis xAxis = new XAxis(); if (personalizedXAxis) { final List<String> xAxisLabels = new ArrayList<String>(); xAxisLabels.add("Left"); xAxisLabels.add("Middle"); xAxisLabels.add("Right"); xAxis.setLabels(xAxisLabels); } chartModel.setXAxis(xAxis); chartModel.addChartConfig(stackedConfig); chart.setBorders(true); chart.setChartModel(chartModel); return chart; } private void populateStacks(final StackedBarChart stackedConfig) { final List<StackValue> leftStackSegments = new ArrayList<StackValue>(); leftStackSegments.add(new StackValue(320, "#0033CC", "L1")); leftStackSegments.add(new StackValue(1500, "#330099", "L2")); final List<StackValue> midStackSegments = new ArrayList<StackValue>(); midStackSegments.add(new StackValue(120, "#009999", "M1")); midStackSegments.add(new StackValue(120, "#00CC00", "M2")); midStackSegments.add(new StackValue(120, "#99FF00", "M3")); final List<StackValue> rightStackSegments = new ArrayList<StackValue>(); rightStackSegments.add(new StackValue(720, "#0033CC", "R1")); rightStackSegments.add(new StackValue(150, "#330099", "R2")); stackedConfig.addStack(leftStackSegments); stackedConfig.addStack(midStackSegments); stackedConfig.addStack(rightStackSegments); } }
-
2 Jun 2010 3:11 PM #2
The generated output is as needed by ofc. we cannot update the OFC version because of API changes. We can only update it with GXT3.
THis is probably an issue in the older OFC version we use.
-
3 Jun 2010 5:57 AM #3
Thats fine sven. I'm not sure if I would even use this feature, but it did cause me some confusion when it stopped working until I realized it had corresponded with calling setLabels.
Thanks for the info.
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
Exporting OFC Chart
By babyblue in forum Ext GWT: DiscussionReplies: 3Last Post: 4 Aug 2010, 4:16 PM -
Stacked bar chart layout
By Jba in forum Ext GWT: DiscussionReplies: 0Last Post: 26 May 2010, 2:12 AM -
Stacked Bar Chart - bars size
By webgunz in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 14 Mar 2010, 8:17 AM -
ChartListener for Stacked bar chart
By kamisama in forum Ext GWT: DiscussionReplies: 7Last Post: 4 Feb 2010, 12:39 PM -
[FIXED] memory leak for OFC chart.
By Tooy in forum Ext GWT: Bugs (2.x)Replies: 4Last Post: 23 Jul 2009, 4:53 AM


Reply With Quote