missing label in chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
daniela
Newbie
Newbie
Posts: 14
Joined: Tue Apr 25, 2006 12:00 am

missing label in chart

Post by daniela » Thu Jun 18, 2009 2:01 pm

Hi,
I have another problem.
we are using Gantt labels and add the data like this:
gLabel.Add( start, end, k, configuration );

I can see that "configuration" is set if I debug the code.
But with more than one entry the label is not shown in the chart.
I attached a screen shot.
I have no idea why the label isn't shown and hope you can help me.

Thanks,
Daniela
Attachments
missing label.JPG
missing label.JPG (28.75 KiB) Viewed 17064 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: missing label in chart

Post by Yeray » Fri Jun 19, 2009 9:32 am

Hi daniela,

It would be helpful if you could send us a code sniped or a simple project we can run as-is here to reproduce the problem and try to find a solution.

Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: missing label in chart

Post by Sandra » Fri Jun 19, 2009 9:42 am

Hello daniela,

I make a simple example using custom labels, and I think that will help you to solve your problem:

Code: Select all

       private void InitializeChart()
        {
            Steema.TeeChart.Styles.Gantt gantt1 = new Steema.TeeChart.Styles.Gantt(tChart1.Chart);
            gantt1.FillSampleValues(10);

            tChart1.Axes.Left.Labels.Items.Clear();

            for (int i = 0; i < gantt1.Count; i++)
            {
                tChart1.Axes.Left.Labels.Items.Add(gantt1.YValues[i], gantt1.Labels[i]);
            }
        }

        }
Please, check code works fine in your application.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

daniela
Newbie
Newbie
Posts: 14
Joined: Tue Apr 25, 2006 12:00 am

Re: missing label in chart

Post by daniela » Fri Jun 19, 2009 1:02 pm

Hi,
I made a small example:

private void InitializeChart()
{
for ( int i = 0; i < 2; i++ )
{
Steema.TeeChart.Styles.Gantt gantt1 = new Gantt();
Gantt gLabel = new Gantt();

tChart1.Series.Add( gLabel );
DateTime fstart = new DateTime( 2009, 6, 19, i, 0, 0 );
DateTime fend = new DateTime( 2009, 6, 19, i,1, 0 );
gLabel.Add( fstart, fend, i, "test" + i.ToString() );

fstart = new DateTime( 2009, 6, 19, i, 5, 0 );
fend = new DateTime( 2009, 6, 19, i, 6, 0 );
gLabel.Add( fstart, fend, i, "test" + i.ToString() );

fstart = new DateTime( 2009, 6, 19, i, 20, 0 );
fend = new DateTime( 2009, 6, 19, i, 21, 0 );
gLabel.Add( fstart, fend, i, "test" + i.ToString() );
}
tChart1.Refresh();
}
}

I get the attached chart, the second gLabel "test1" is missing.
Attachments
missing label test.JPG
missing label test.JPG (16 KiB) Viewed 16988 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: missing label in chart

Post by Yeray » Fri Jun 19, 2009 3:18 pm

Hi

I've modified your code introducing a little variant of the code that Sandra suggested to you and it seems to work fine here:

Code: Select all

        private void InitializeChart()
        {
            for ( int i = 0; i < 2; i++ )
            {
                //Steema.TeeChart.Styles.Gantt gantt1 = new Gantt();
                Gantt gLabel = new Gantt();

                tChart1.Series.Add( gLabel );
                DateTime fstart = new DateTime( 2009, 6, 19, i, 0, 0 );
                DateTime fend = new DateTime( 2009, 6, 19, i,1, 0 );
                gLabel.Add( fstart, fend, i, "test" + i.ToString() );

                fstart = new DateTime( 2009, 6, 19, i, 5, 0 );
                fend = new DateTime( 2009, 6, 19, i, 6, 0 );
                gLabel.Add( fstart, fend, i, "test" + i.ToString() );

                fstart = new DateTime( 2009, 6, 19, i, 20, 0 );
                fend = new DateTime( 2009, 6, 19, i, 21, 0 );
                gLabel.Add( fstart, fend, i, "test" + i.ToString() );
            }

            tChart1.Axes.Left.Labels.Items.Clear();

            for (int i = 0; i < tChart1.Series.Count; i++)
            {
                tChart1.Axes.Left.Labels.Items.Add(tChart1[i].YValues[0], tChart1[i].Labels[0]);
            }
            tChart1.Refresh();
        }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

daniela
Newbie
Newbie
Posts: 14
Joined: Tue Apr 25, 2006 12:00 am

Re: missing label in chart

Post by daniela » Mon Jun 22, 2009 12:30 pm

Thanks a lot, it works with the additional code

Code: Select all

tChart1.Axes.Left.Labels.Items.Clear();

            for (int i = 0; i < tChart1.Series.Count; i++)
            {
                tChart1.Axes.Left.Labels.Items.Add(tChart1[i].YValues[0], tChart1[i].Labels[0]);
            }
            tChart1.Refresh();

TonyVSUK
Advanced
Posts: 163
Joined: Wed Mar 01, 2006 12:00 am

Re: missing label in chart

Post by TonyVSUK » Mon Sep 27, 2010 11:57 am

I'm hitting this bug now. Is it going to be fixed soon?

Seems that if the title for the plot is not in series 0, it does not get displayed on the left/right hand axis.

The only way around is to set up the custom axis labels first, then set up the plots.


Visual basic example below.



TChart1.AddSeries scGantt
TChart1.AddSeries scGantt
TChart1.Aspect.View3D = False

' Disable automatic sorting by date
TChart1.Series(0).XValues.Order = loNone
TChart1.Series(1).XValues.Order = loNone

' Fill Gantt with sample date-time values:
With TChart1.Series(0)
.asGantt.AddGantt DateSerial(2002, 4, 1), DateSerial(2002, 4, 10), 0, "Series 1 - A"
.asGantt.AddGantt DateSerial(2002, 4, 5), DateSerial(2002, 4, 15), 1, "Series 1 - B"

' Make marks visible
.Marks.Visible = True
.Marks.ShadowSize = 0
.Marks.Gradient.Visible = True
End With
With TChart1.Series(1)
.asGantt.AddGantt DateSerial(2002, 5, 2), DateSerial(2002, 5, 8), 2, "Series 2 - C"
.asGantt.AddGantt DateSerial(2002, 5, 9), DateSerial(2002, 5, 21), 3, "Series 2 - D"

' Make marks visible
.Marks.Visible = True
.Marks.ShadowSize = 0
.Marks.Gradient.Visible = True
End With

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: missing label in chart

Post by Sandra » Tue Sep 28, 2010 9:45 am

Hello TonyVSUK,

It is not a bug; it is behaviour of TeeChart. Always you add more of one Series in your Chart, labels you are visualized, are labels of first Series that you have been added. If you want add labels of each series to the axes, you need use custom labels as is done in below code:

Code: Select all

Private Sub Form_Load()

TChart1.AddSeries scGantt
TChart1.AddSeries scGantt
TChart1.Aspect.View3D = False

' Disable automatic sorting by date
TChart1.Series(0).XValues.Order = loNone
TChart1.Series(1).XValues.Order = loNone
' Fill Gantt with sample date-time values:
With TChart1.Series(0)
.asGantt.AddGantt DateSerial(2002, 4, 1), DateSerial(2002, 4, 10), 0, "Series 1 - A"
.asGantt.AddGantt DateSerial(2002, 4, 5), DateSerial(2002, 4, 15), 1, "Series 1 - B"
' Make marks visible
.Marks.Visible = True
.Marks.ShadowSize = 0
.Marks.Gradient.Visible = True
End With
With TChart1.Series(1)
.asGantt.AddGantt DateSerial(2002, 5, 2), DateSerial(2002, 5, 8), 2, "Series 2 - C"
.asGantt.AddGantt DateSerial(2002, 5, 9), DateSerial(2002, 5, 21), 3, "Series 2 - D"

' Make marks visible
.Marks.Visible = True
.Marks.ShadowSize = 0
.Marks.Gradient.Visible = True
End With

TChart1.Axis.Left.Labels.Clear

 For t = 0 To TChart1.SeriesCount - 1
   For j = 0 To TChart1.Series(t).Count - 1
    
     TChart1.Axis.Left.Labels.Add TChart1.Series(t).YValues.Value(j), TChart1.Series(t).PointLabel(j)
    Next j
 Next t
TChart1.Environment.InternalRepaint
     
End Sub
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

TonyVSUK
Advanced
Posts: 163
Joined: Wed Mar 01, 2006 12:00 am

Re: missing label in chart

Post by TonyVSUK » Tue Sep 28, 2010 10:10 am

It is not a bug; it is behaviour of TeeChart. Always you add more of one Series in your Chart, labels you are visualized, are labels of first Series that you have been added. If you want add labels of each series to the axes, you need use custom labels as is done in below code:
This cannot be right. Are you saying that I can add as many series to a chart as I want, but only ever get labels from the 1st series?

Every other series behaves properly, you add a series and the label shows up. Just Gantt charts only show the first series' labels. They should show all the other series labels as well, and if not, why not?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: missing label in chart

Post by Sandra » Tue Sep 28, 2010 2:30 pm

Hello TonyVSUK,
This cannot be right. Are you saying that I can add as many series to a chart as I want, but only ever get labels from the 1st series?
Every other series behaves properly, you add a series and the label shows up. Just Gantt charts only show the first series' labels. They should show all the other series labels as well, and if not, why not?
Sorry, I have checked it only with last version of TeeChart.Net and ActivetX 8 and in both cases using text labels. I have informed you that in next version of TeeChart Pro v2010 ActiveX this behaviour don’t appear and is working properly. At the moment, you have used custom labels.

On the other hand, I have added your requests in TeeChart .Net wish-list with number [TF02015173]to be considered inclusion in next versions of TeeChart.Net.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

TonyVSUK
Advanced
Posts: 163
Joined: Wed Mar 01, 2006 12:00 am

Re: missing label in chart

Post by TonyVSUK » Tue Sep 28, 2010 2:32 pm

Sorry, I don't understand. Do you mean the bug is fixed in TeeChart v2010?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: missing label in chart

Post by Sandra » Tue Sep 28, 2010 2:43 pm

Hello TonyVSUK,

It is fixed in last version of TeeChart VCL 2010 and for next version TeeChart Pro Activex 2010, but not in TeeChart .Net (TF02015173).

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

TonyVSUK
Advanced
Posts: 163
Joined: Wed Mar 01, 2006 12:00 am

Re: missing label in chart

Post by TonyVSUK » Tue Sep 28, 2010 2:59 pm

Thanks.

Post Reply