We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Chart not displaying

Hi,

I am trying to render a chart using the example provided in another forum post but the page is just not displaying anything.

I have changed the syncfuson version to reflect my version and I am now totally confused as to how to get the sample working.

Any advice would be greatly appreciated.

Thanks,

Alex

Attachment: Bands_f7ebb367.zip

5 Replies

KC Kalaimathi Chellaiah Syncfusion Team April 19, 2019 08:15 AM UTC

Hi Alex, 
 
Greetings from Syncfusion. 
 
We have analyzed your query. We have prepared a sample based on your requirement. In that chart is working fine. Please find below sample, 
 
 
Screenshot: 
 
 
 
Since we are not aware of your exact scenario which the issue is reproduced. Kindly, share the following information which will be more helpful for further analysis and provide you the solution sooner. 
 
  • Provide your sample with replication steps.
  • Try to reproduce the reported scenario with the above sample and revert us.
  • Share your Syncfusion Product Version
 
Regards, 
Kalai. 



AJ Alex Jermy April 23, 2019 09:34 AM UTC

Hi,

This is in fact displaying now.

For some reason locating the 'scripts' in the 'body' rather than the 'head' fixed this issue. I am not really sure why that made a difference but that solved the problem.

Thanks,

Alex


BP Baby Palanidurai Syncfusion Team April 23, 2019 09:38 AM UTC

Hi Alex,

Most welcome. Kindly revert us, if you need further assistance. We are always happy in assisting you.

Regards,
Baby.


AJ Alex Jermy April 23, 2019 03:18 PM UTC

Hi,

I am now having some trouble with binding the Datasource to the chart. For some reason the chart is not displaying the correct fields and is just displaying as empty. This would seem to suggest that there is some data being bound though because otherwise it would display with random data as it does in the example.

I have attached a zip file containing the ASP and the C#.

Thanks,

Alex

Attachment: PlanningAnalysis_50861b21.zip


BP Baby Palanidurai Syncfusion Team April 24, 2019 12:30 PM UTC

Hi Alex, 
 
Thanks for the update. 
 
We have analyzed your query with an attached screenshot. From your code snippet, we suspect you have used SQL to get chart data source. Based on that we have created a simple sample for a chart using sqlDataAdapter.  In that chart is working fine. Also If we do not bind any data source to the chart, then the default chart will render automatically. But once you bind the data source, then the chart only render if the data source contains any data. Please find below sample and code snippet. 
 
Code Snippet: 
[chartFeatures.aspx.vb]: 
  protected void Page_Load(object sender, EventArgs e) 
        { 
            Series series1 = new Series(); 
            Series series2 = new Series(); 
            List<ChartSqlData> data = new List<ChartSqlData>(); 
            string connectionString = null; 
            SqlDataAdapter adapter = new SqlDataAdapter(); 
            DataSet dataset = new DataSet(); 
            connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=false;Connect Timeout=100;"; 
            SqlConnection con = new SqlConnection(connectionString); 
            con.Open(); 
 
            string command2 = "SELECT * FROM [Products] WHERE UnitPrice < 10"; 
            SqlCommand cmd1 = new SqlCommand(command2, con); 
            adapter.SelectCommand = cmd1; 
            adapter.Fill(dataset); 
            for (var i = 0; i < dataset.Tables[0].Rows.Count; i++) 
            { 
                string x1 = Convert.ToString(dataset.Tables[0].Rows[i]["ProductName"]); 
                double y1 = Convert.ToDouble(dataset.Tables[0].Rows[i]["UnitPrice"]); 
                double y2 = Convert.ToDouble(dataset.Tables[0].Rows[i]["UnitsInStock"]); 
                data.Add(new ChartSqlData(x1, y1, y2)); 
            } 
            this.Chart1.DataSource = data; 
            this.Chart1.DataBind(); 
        } 
    } 
 
Screenshot: 
 
 
 
Since we are not aware of your exact scenario which the issue is reproduce. Kindly check the above sample and revert us with following details which will be more helpful for further analysis and provide you the solution sooner. 
 
  • Provide your sample with replication steps.
  • Try to reproduce the reported scenario with the above sample and revert us.
  • Share your datasource file (or) screenshot
 
Regards, 
Baby.

Loader.
Live Chat Icon For mobile
Up arrow icon