I have a single record pie bound to a datasource and I can't find how to define the labels. Whatever I try it keeps show the name of the columns.
Could someone help please?
pie one record labels
Re: pie one record labels
Hi bsoft,
Here it is the example from the Tutorial 8 - ADO Database access adapted to a Pies series:
Here it is the example from the Tutorial 8 - ADO Database access adapted to a Pies series:
Code: Select all
private void InitializeChart()
{
string sQuery = "select * from Employee";
string myConnString = "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\Program Files\\Steema Software\\TeeChart for .NET v3\\Sample data\\TeeChart.mdb;Uid=Admin;Pwd=;";
System.Data.Odbc.OdbcConnection myConnection = new System.Data.Odbc.OdbcConnection(myConnString);
System.Data.Odbc.OdbcCommand myCommand = new System.Data.Odbc.OdbcCommand(sQuery, myConnection);
myConnection.Open();
System.Data.Odbc.OdbcDataReader myReader = myCommand.ExecuteReader();
int ValueColumn = myReader.GetOrdinal("SALARY");
int LabelColumn = myReader.GetOrdinal("LASTNAME");
Steema.TeeChart.Styles.Pie pie1 = new Steema.TeeChart.Styles.Pie(tChart1.Chart);
while (myReader.Read())
{
pie1.Add(Convert.ToDouble(myReader[ValueColumn]), Convert.ToString(myReader[LabelColumn]));
}
myReader.Close();
myConnection.Close();
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: pie one record labels
Hi Yeray,
Thanks a lot for your answer but could you expain to me something. The only way to do that is to use an TChart insteed of a TDBChart?
I don't know if i was clear enough to my previous post so I will try to explain to you tha whole thing once again.
I use a TDBChart. I create a Pie Series. In the Datasource tab I select "Single record" on the top of the form and then I select my TDatasource and the columns I want to display.
My TADODataset returns only one record and I have also set the displaylabel of the fields to what I want to be shown in the chart.
But, when i run the program it keeps show the name of the columns eg. column name = COL1 and displayLabel = '2010'.
I hope i was clear enough this time. It's difficult to me to believe that for something so simple there is no simple way to achieve this.
Thanks again and I'm waiting for your answer...
Thanks a lot for your answer but could you expain to me something. The only way to do that is to use an TChart insteed of a TDBChart?
I don't know if i was clear enough to my previous post so I will try to explain to you tha whole thing once again.
I use a TDBChart. I create a Pie Series. In the Datasource tab I select "Single record" on the top of the form and then I select my TDatasource and the columns I want to display.
My TADODataset returns only one record and I have also set the displaylabel of the fields to what I want to be shown in the chart.
But, when i run the program it keeps show the name of the columns eg. column name = COL1 and displayLabel = '2010'.
I hope i was clear enough this time. It's difficult to me to believe that for something so simple there is no simple way to achieve this.
Thanks again and I'm waiting for your answer...
Re: pie one record labels
Hi bsoft,
The difference between TChart and TDBChart is that with TDBChart the connections to databases are available at design time and at runtime, while with TChart only at runtime.
For "Singe Record" usage, please, take a look at the demo at All features/Welcome !/Database Charts/Single Record.
The difference between TChart and TDBChart is that with TDBChart the connections to databases are available at design time and at runtime, while with TChart only at runtime.
For "Singe Record" usage, please, take a look at the demo at All features/Welcome !/Database Charts/Single Record.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |