Jump to content
JChartFX Community

Search the Community

Showing results for tags 'StackedBar JQuery'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • jChartFX
    • General Questions
    • jQuery/jQuery UI
    • Styling and Aesthetics

Calendars

There are no results to display.


Found 1 result

  1. Stacked Bar Chart

    Hi We are trying to create a stacked bar chart but we keep getting No Data Available. We did have the example working but when we retrieved data from our database the chart doesn't display. Here is the code <head> <link rel="stylesheet" type="text/css" href="/jChartFX/styles/jchartfx.css" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script> <script type="text/javascript" src="/jChartFX/js/jchartfx.system.js"></script> <script type="text/javascript" src="/jChartFX/js/jchartfx.coreVector.js"></script> <script type="text/javascript" src="/jChartFX/js/jchartfx.advanced.js"></script> </head> <body> <input type="text" id="startdate" readonly><input type="text" id="enddate"> <input type="button" id="refresh1" value="Refresh"> <table width="100%"> <tr> <td><div id="ChartDivUserPoints" style="width:600px;height:300px"></div></td> </tr> </table> <script type="text/javascript" language="javascript"> jQuery.noConflict(); jQuery(document).ready(function() { CreateUserPoints(); }); jQuery("#refresh1").click(function() { CreateUserPoints(); }); function CreateUserPoints() { chartuserpoints = new cfx.Chart(); chartuserpoints.setGallery(cfx.Gallery.Bar); chartuserpoints.getAllSeries().setStackedStyle(cfx.Stacked.Normal); var titles = chartuserpoints.getTitles(); var title = new cfx.TitleDockable(); title.setText("User Points"); titles.add(title); chartuserpoints.getAxisY().getLabelsFormat().setFormat(cfx.AxisFormat.Currency); var startdate = jQuery('#startdate').val(); var enddate = jQuery('#enddate').val(); jQuery.ajax({ type: "POST", dataType: "json", data:{startdate : startdate, enddate : enddate}, url: "/reports/StackedBarData.php", success: function(data) { chartuserpoints.setDataSource(data); var divHolder = document.getElementById('ChartDivUserPoints'); jQuery("#ChartDivUserPoints").html(""); chartuserpoints.create(divHolder); } , error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); } </script> The data from the database is as follows: [{ "username" : "Jill", "posts" : "106", "friends" : "", "status" : "", "polls" : ""},{ "username" : "Carly", "posts" : "93", "friends" : "", "status" : "", "polls" : ""},{ "username" : "Chris", "posts" : "11", "friends" : "", "status" : "", "polls" : ""}] Any help would really be appreciated Thanks Rich
×