Search the Community

Showing results for tags 'database'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Company Forums
    • Company News
  • Product Forums
    • FusionCharts XT
    • FusionWidgets XT
    • PowerCharts XT
    • FusionMaps XT
    • Collabion Charts for SharePoint
    • jQuery Plugin for FusionCharts
    • AngularJS plugin
    • ReactJS plugin
  • General Forums
    • FusionCharts Jobs and Consultation
    • FusionLounge

Found 5 results

  1. I'm trying to create a stacked chart with from a database into a JSON Append object and am having some trouble. I have a set a weeks to display on the X axis. The Y axis will display a number of Hours per status. This is my first chart with a JSON object within MVC and instead of getting an error message, the screen just shows "Charts...." text. I believe my issue is mainly within my foreach loop through the status. I also need to implement the passing of the week along with the status so that I am getting the "Hours" for that status and week. Please let me know if you have any questions. I have all my code in page for now. Thank You!! --------------------------------------------------------------- public class WOWeekData { //public int lworkweekcode { get; set; } public DateTime WkDate { get; set; } } public class WOHrsData { //public int WOStatusID { get; set; } //public int lworkweekcode { get; set; } public string WOStatus { get; set; } public int WkHrs { get; set; } public DateTime WkDate { get; set; } } public class HomeController : Controller { List<WOWeekData> wdata_list = new List<WOWeekData>(); List<WOHrsData> hdata_list = new List<WOHrsData>(); public string createChart() { string dat = getData(); Chart cc = new Chart("stackedcolumn3d", "mychart", "750", "550", "json", dat); return cc.Render(); } public string getData() { List<DateTime> WOWkDate2_list = new List<DateTime>(); List<string> WOStatus_list = new List<string>(); List<int> WOWkHrs_list = new List<int>(); List<DateTime> WOWkDate_list = new List<DateTime>(); string db= ConfigurationManager.ConnectionStrings["string"].ConnectionString; SqlConnection con = new SqlConnection(); con.ConnectionString = db; con.Open(); SqlCommand com = new SqlCommand("Select distinct(WkDate) from v_SampleData2", con); SqlDataReader sda = com.ExecuteReader(); while (sda.Read()) { WOWeekData wod = new WOWeekData(); wod.WkDate = DateTime.Parse(sda[0].ToString()); //wod.W = Int32.Parse(sda[1].ToString()); //wod.P = Int32.Parse(sda[2].ToString()); //wod.H = Int32.Parse(sda[3].ToString()); wdata_list.Add(wod); } foreach (WOWeekData w in wdata_list) { WOWkDate_list.Add(w.WkDate); } sda.Close(); SqlCommand com2 = new SqlCommand("Select * from v_SampleData2", con); SqlDataReader sda2 = com2.ExecuteReader(); while (sda2.Read()) { WOHrsData hrs = new WOHrsData(); hrs.WOStatus = sda2[1].ToString(); hrs.WkHrs = Int32.Parse(sda2[2].ToString()); hrs.WkDate = DateTime.Parse(sda2[0].ToString()); hdata_list.Add(hrs); } foreach (WOHrsData h in hdata_list) { //WOWk.Add(h.WkDate); WOStatus_list.Add(h.WOStatus); WOWkHrs_list.Add(h.WkHrs); WOWkDate2_list.Add(h.WkDate); } sda2.Close(); con.Close(); con.Dispose(); //building JSON String StringBuilder JSON = new StringBuilder(); JSON.Append("{" + "'chart': {" + "'caption': 'One Chart Per Department'," + // "'exportEnabled':'1'," + "'xAxisname': 'Weeks'," + "'yAxisName': 'Hours'," + " }," ); //appenfing into StringBuilder objectiterating through collections JSON.Append("'categories': [{" + "'category': [ "); foreach (var wk in WOWkDate_list.Distinct()) { //for last element escaping comma if (wk == WOWkDate_list.Distinct().Last()) { JSON.Append("{ 'label': '" + wk + "' }"); break; } JSON.Append("{ 'label': '" + wk + "' },"); } JSON.Append("]" + "}]," + "'dataset': ["); foreach (var wostat in WOStatus_list.Distinct()) { List<int> wohrsvalue = getWOHrsData(wostat); JSON.Append("{" + "'seriesname':" + "'" + wostat + "'," + "'data': ["); foreach (var whrs in wohrsvalue) { if (whrs == wohrsvalue.Last()) { JSON.Append("{" + "'value':" + "'" + whrs + "'}"); break; } JSON.Append("{" + "'value':" + "'" + whrs + "'},"); } if (wostat == WOStatus_list.Distinct().Last()) { JSON.Append("]" + " }"); break; } JSON.Append("]" + " },"); } //replacing all ' into " string str = JSON.ToString().Replace('\'', '\"'); return str; } public List<int> getWOHrsData(string wostat) { List<int> hrsvalue = new List<int>(); var seriesLink = from wo in hdata_list where wo.WOStatus == wostat select new { linkdata = wo.WkHrs }; foreach (var obj in seriesLink) { hrsvalue.Add(obj.linkdata); } return hrsvalue; } public ActionResult Index() { ViewBag.mydata = createChart(); return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } }
  2. I would like to ask how to create a project that has FusionCharts taking data from a database using the xampp 7.2 application. The tutorial is made for wampp. I have tried this tutorial ( https://www.fusioncharts.com/dev/using-with-server-side-languages/tutorials/php-mysql-charts ) using the xampp application but it does not work. How do I implement FusionCharts' database integration using xampp? Please teach me using the example in the link if possible and provide details on the folders/directories used along with the code. I have attached the full sample project I created. The project was placed in "xampp/htdocs/FusionCharts Sample/ ". FusionCharts_Sample.rar
  3. SQL WITH JSON

    Just starting with FusionCharts so bear with me. I've set up the example charts and all works fine. Now I want to pull data from a SQL database. I thought this would be easier now that SQL can output JSON data. However, so far I've not been able to make it work. In the example on the homepage, for asp.net, the JSON data looks like this: "{\n \"chart\": {\n \"caption\": When I use a SQL query returning JSON and not a data set I get: "\"chart\": { \"caption\": My SQL statement: SELECT TOP 1000 Topping, CAST(Slices as varchar(10)) as Slices FROM dbo.tblPizza FOR JSON PATH; So, two questions: a. Can we use SQL's output of JSON data? If so how? b. If "a" isn't possible, how can I get all those "\n"'s in the right places to make the database output work? I've uploaded a file that shows more of the above strings from the FusionChart homepage example and what I get from SQL. Thanks for you help. FusionChart_Comparison.txt
  4. Hello, I'm new to Fusioncharts and trying to demo a Gantt chart by days populated from a database. The tasks can span across large periods of time but I always want the initial view to display 7 days prior to the current date through 22 days forward. I was thinking of creating a calendar table so i know when the start and stop date of every month based upon the current day. What is the best way to retrieve the data? Would it be to have a query for each set of data; one to retrieve the tasks, processes and then the calendar? I see a lot of examples like this: <categories> <category start="08/01/2014" end="08/31/2014" label="Aug '14" /> <category start="09/01/2014" end="09/30/2014" label="Sep '14" /> <category start="10/01/2014" end="10/31/2014" label="Oct '14" /> <category start="11/01/2014" end="11/30/2014" label="Nov '14" /> <category start="12/01/2014" end="12/31/2014" label="Dec '14" /> <category start="01/01/2015" end="01/31/2015" label="Jan '15" /> <category start="02/01/2015" end="02/28/2015" label="Feb '15" /> <category start="03/01/2015" end="03/31/2015" label="Mar '15" /> </categories> But if I want my labels to be day instead of a span of time then do I need the start date, end date and label to be the same, replicated for the number of days I want to show on the table. Like this? <category start="01/20/2016" end="01/20/2016" label="01/20/2016" /> Is this the best way to do this? Also, I was using the "scrolltodate" option so that the chart is always shows up with the current date by default, but that doesn't seem to working? Any thoughts? thank you! Jenise
  5. Halo, Can Somebody help me for make example multiple series using JSON in PHP Framework Codeigniter with MySQL, Not using XML but JSON. Please can someone to help me.