Sign in to follow this  
tmazzotta

Simple Bar Chart Coming Up Empty - not showing any bars :(

Recommended Posts

Hello -

I am using FusionCharts v3.0 and am trying to figure out why the following code is resulting in an empty graph (see attached image)

 

I know the version I am using is old.. We have plans to upgrade to the latest version,but we need to find the time to do so.

The text (result.toString()) seems to be fine but for some reason the graph shows up empty :(

 

any help that you can provide would be much appreciated!

 

====================================================================================

String CHART_COLOR_GREEN = "00CC66";
String CHART_COLOR_BLUE = "92B0EF";
String CHART_COLOR_PURPLE = "A287BE";
String CHART_COLOR_GRAY = "999999";
String CHART_COLOR_TEAL = "33CCFF";
String CHART_COLOR_GREEN2 = "55AE2B";
String CHART_COLOR_RED = "ce2a0d";
String CHART_COLOR_YELLOW = "fff200";
 
 
String[] COLORS_ARRAY = new String[]{
CHART_COLOR_GREEN,
CHART_COLOR_BLUE,
CHART_COLOR_PURPLE,
CHART_COLOR_TEAL,
CHART_COLOR_RED,
CHART_COLOR_YELLOW,
};
 

 

StringBuffer result = new StringBuffer();
 
final int revenueAnchorRadius = 5;
final int revenueLineThickness = 3;
final double rMax=100, rMin=0;
 
result.append("<chart   anchorRadius='" + revenueAnchorRadius + "' animation='0' xaxisname='X' PYaxisname='Y'  decimals='0' showdivlinesecondaryvalue='0' showSecondaryLimits='0'  formatNumberScale='0'  ");
result.append("  PYAxisMaxValue='" + rMax + "'  SYAxisMaxValue='" + rMax + "'  ");
result.append("  PYAxisMinValue='" + rMin + "'  SYAxisMinValue='" + rMin + "'  ");
 
 
result.append("  baseFont='" + getChartFont() + "' ");
result.append("  baseFontSize='" + getFontSize_BaseFont(isMini) + "' ");
result.append("  showLegend='1' ");
result.append("   numDivLines='3'  ");
result.append("  chartLeftMargin ='5' chartRightMargin ='5'  chartTopMargin ='15' chartBottomMargin ='15'");
result.append(" caption='' ");
//result.append("  lineThickness='2' ");
result.append("  baseFontColor='000000' ");
result.append(" canvasBorderColor='CCCCCC'");
result.append("  drawAnchors ='1'");
result.append("  anchorSides ='4'");
result.append(" numberPrefix='$'");
result.append(">"); //Not sure why this is needed
 
result.append("    <categories>");  //Labels on X-Axis
result.append("       <category label='" +"X2priorPeriodDesc"  +"'/>");
result.append("       <category label='" +"priorPeriodDesc"  +"'/>");
result.append("       <category label='" + "currPeriodDesc"  + "'/>");
result.append("    </categories>");
 
result.append("    <dataset parentYAxis='P'>   ");
result.append("       <dataset seriesName='"+"A"+ "' color='" + COLORS_ARRAY[1] + "' showValues='0'>");
result.append("       <set value='10.1' />");
result.append("       <set value='20.2' />");
result.append("       <set value='30.3' />");
result.append("       </dataset>");
result.append("       <dataset seriesName='"+"B"+"' color='" + COLORS_ARRAY[2] + "' showValues='0' >");
result.append("       <set value='10.0' />");
result.append("       <set value='20.0' />");
result.append("       <set value='30.0' />");
result.append("      </dataset>   ");
result.append("       <dataset seriesName='"+"C"+"' color='" + COLORS_ARRAY[3] + "' showValues='0' >");
result.append("       <set value='10.0' />");
result.append("       <set value='20.0' />");
result.append("       <set value='30.0' />");
result.append("      </dataset>   ");
result.append("       <dataset seriesName='"+"D"+"' color='" + COLORS_ARRAY[4] + "' showValues='0' >");
result.append("       <set value='10.0' />");
result.append("       <set value='20.0' />");
result.append("       <set value='30.0' />");
result.append("      </dataset>   ");
result.append("   </dataset>   "); //end of <dataset parentYAxis='P'>
 
result.append("   <lineset seriesName='"+"LAST_ROUND"+"' showValues='0' lineThickness='"+ revenueLineThickness + "'  color='" + COLORS_ARRAY[0] + "'>");
result.append("       <set value='20.0' toolText='"+"revenuePriorPlannedTooltip"+"' />");
result.append("       <set value='23.0'  toolText='"+"revenuePriorActualTooltip"+"' />");
result.append("       <set value='25.0'  toolText='"+"revenueCurrForecastTooltip"+"' />");
result.append("   </lineset>");
 
/*
result.append("    <styles>");
result.append("        <definition>");
result.append("            <style name='TOOLTIP' type='font' font='" + getChartFont() + "' size='" + getFontSize_Tooltip(isMini) + "' isHTML='1'  color='000000'/>");
result.append("            <style name='DATALABELS' type='font' font='" + getChartFont() + "' size='" + getFontSize_Datalabels(isMini) + "'  isHTML='1'  />");
result.append("        </definition>");
result.append("        <application>");
result.append("            <apply toObject='TOOLTIP' styles='TOOLTIP' />");
result.append("            <apply toObject='DATALABELS' styles='DATALABELS' />");
result.append("        </application>");
result.append("    </styles>");
*/
 
result.append(" </chart> ");
 
//log.info(result.toString());
return result.toString();

post-7227-0-96592000-1449649004_thumb.png

Edited by tmazzotta

Share this post


Link to post
Share on other sites

Hi,

 

If you can share the solution, it will be helpful to others in place of deleting the post.

 

Also, we would recommend to use the latest version of FusionCharts which is a pure HTML5 component.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this