Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic PieChart ignore Dataset (Read 10203 times)
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
PieChart ignore Dataset
Sep 25th, 2008 at 9:44am
Print Post  
Hi. I'm tring to create a piechart in a webapplication.

I set objectdatasource of pie chart correctly (i suppose Sad ) but when i open my web page appear only the background of the diagram.

first question: is there a way to check i set correctly the objectdatasource and if the piechart read data in the correct way?

second question: how can i set x and ydata of my chart?

thanks
« Last Edit: Sep 25th, 2008 at 12:15pm by alesdario »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PieChart ignore Dataset
Reply #1 - Sep 25th, 2008 at 12:59pm
Print Post  
Hi,

Have you set the chart's DataField property to the name of a column from the data source?

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: PieChart ignore Dataset
Reply #2 - Sep 25th, 2008 at 1:53pm
Print Post  
How can i do this? Tongue

Is there any example in MasterChart demo who show a bind Chart-DataBase or chart-Table?

Tanks
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PieChart ignore Dataset
Reply #3 - Sep 25th, 2008 at 3:03pm
Print Post  
Select the chart while in designer view and in the property grid set the DataField property. Which version of the control are you using?

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: PieChart ignore Dataset
Reply #4 - Sep 25th, 2008 at 3:34pm
Print Post  
I've yet done what you write me. But list of databind is empty.

I use 3.2 demo version (i'm testing the library) of Masterchart

Are there some examples about binding of chart and database,table or some other tipe of datasource?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PieChart ignore Dataset
Reply #5 - Sep 25th, 2008 at 8:03pm
Print Post  
The SiteStats sample shows binding to an AccessDataSource, though it's a little buggy in design time. After a fresh installation you might see empty chart objects instead of image, until you click Refresh Schema from the data-source object command list. Tomorrow we'll try how binding to ObjectDataSources works. Anyway even if you cannot see column names in the combo box, you should be able to type a name there, or assign it in run-time from the Load event.

Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: PieChart ignore Dataset
Reply #6 - Sep 26th, 2008 at 8:22am
Print Post  
from my source code:

Code
Select All
 this.PieChart1.OuterLabels = dataTableChart.Columns[1]; 



error:

Code
Select All
Cannot implicitly convert type 'System.Data.DataColumn' to 'System.Collections.IList'.
An explicit conversion exists (are you missing a cast?) 


What type of cast is correct?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PieChart ignore Dataset
Reply #7 - Sep 26th, 2008 at 10:07am
Print Post  
Assuming you have set DataSource or DataSourceID, set the OuterLabelsField property to the name of the column that contains the labels. Otherwise you will have to load the labels into an array or a List<string> and assign the array to OuterLabels.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PieChart ignore Dataset
Reply #8 - Sep 26th, 2008 at 10:36am
Print Post  
ObjectDataSource worked fine in our test:

TestDataBO.cs
Code
Select All
using System.Collections.Generic;

public static class TestDataBO
{
	public static List<TestDataItem> GetItems()
	{
		List<TestDataItem> items = new List<TestDataItem>();
		items.Add(new TestDataItem(33, "test"));
		items.Add(new TestDataItem(77, "label"));
		items.Add(new TestDataItem(55, "another one"));
		return items;
	}
}
 



TestDataItem.cs
Code
Select All
/// <summary>
/// Summary description for TestDataItem
/// </summary>
public class TestDataItem
{
	public TestDataItem(double data, string label)
	{
		this.data = data;
		this.label = label;
	}

	public double Data
	{
		get { return data; }
		set { data = value; }
	}

	public string Label
	{
		get { return label; }
		set { label = value; }
	}

	private double data;
	private string label;
}
 



Drop an ObjectDataSource onto the form, configure it, select TestDataBO as the business object and choose GetItems() as the SELECT method. Now if you select the piechart in the designer, you should be able to select the ObjectDataSource instance from the DataSourceID property drop-down, and see Data and Label as available options in the drop-down for the various Field properties.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: PieChart ignore Dataset
Reply #9 - Sep 29th, 2008 at 7:39am
Print Post  
Very excellent support. Tanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint