Page 1 of 1

problem using logarythmic in the chart

Posted: Thu May 15, 2008 9:46 am
by 9527011
We use teechart v7.0.0.4

we use much logarthmic and automatic scaling in our charts.
The problem is, that this scaling doesn't lookgood the most times, or worse, it is wrong.

When we use logarthymic scaling, min value of the left axis start from 1 and not 0 so labels of values that are less than 0, are displayed beneath the chart instead of on it. lavels that are for value 0 are displayed on the chart although there is no 0 value in the left axis.

Is there a place I can upload sceenshots to explain our problem?

Thanks
Zoe.

Posted: Thu May 15, 2008 11:06 am
by narcis
Hi Zoe,

First of all, please notice there are much newer TeeChart Pro v7 ActiveX releases available at the client area. Could you please try uninstalling v7.0.0.4, download and install v7.0.1.4 and check if the problem persists?

If so, please send us a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Thu May 15, 2008 12:22 pm
by 9527011
Thank you for your fast reply.

I have uploaded soem images, there is no way for me at the moment to upload a small project.


Please note, that all chart use the exact same design!
BUG_25289_1.jpg) it seems that the left axis is at 0, which is the only good thing in this report, but there are no bars, the bars would start at the middle of the screen and the values 0 and 1 are at the same level.

BUG_25289_2.jpg) We set the lefty axis scaling to be logarythm 10. the min value is set to 0 but in the chart you see 1 and we get values (marks) between 0 and 1 which overlap with the bottom-axis-label and values (the mark with the value 0.67). also mark with the value 0 are above mark with the value 0.67 which is not logical. it is impossible to read this chart.

BUG_25289_3.jpg) This time there is a 0 value, but it overlaps with the legend


thanks
Zoe

Posted: Thu May 15, 2008 1:19 pm
by narcis
Hi Zoe,

Thanks for the information.
BUG_25289_1.jpg) it seems that the left axis is at 0, which is the only good thing in this report, but there are no bars, the bars would start at the middle of the screen and the values 0 and 1 are at the same level.
It's very difficult for us guessing which is the problem here without seeing how the chart is created and being able to reproduce and debut the issue here. We would really appreciat if you could arrange a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.
BUG_25289_2.jpg) We set the lefty axis scaling to be logarythm 10. the min value is set to 0 but in the chart you see 1 and we get values (marks) between 0 and 1 which overlap with the bottom-axis-label and values (the mark with the value 0.67). also mark with the value 0 are above mark with the value 0.67 which is not logical. it is impossible to read this chart.
You can try setting left axis minimum to zero:

Code: Select all

    TChart1.Axis.Left.AutomaticMinimum = False
    TChart1.Axis.Left.Minimum = 0
BUG_25289_3.jpg) This time there is a 0 value, but it overlaps with the legend


You could use the solution on previous reply or use OnGetAxisLabel event to hide the zero label, for example:

Code: Select all

Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
    If Axis = 0 And LabelText = "0" Then
        LabelText = ""
    End If
End Sub

Posted: Thu May 15, 2008 2:04 pm
by 9527011
Quote:
BUG_25289_1.jpg) it seems that the left axis is at 0, which is the only good thing in this report, but there are no bars, the bars would start at the middle of the screen and the values 0 and 1 are at the same level.


It's very difficult for us guessing which is the problem here without seeing how the chart is created and being able to reproduce and debut the issue here. We would really appreciat if you could arrange a simple example project we can run "as-is" to reproduce the problem here.
If I send you a .tee file that is defined as the problem, can that be enough for you to check?
Quote:
BUG_25289_2.jpg) We set the lefty axis scaling to be logarythm 10. the min value is set to 0 but in the chart you see 1 and we get values (marks) between 0 and 1 which overlap with the bottom-axis-label and values (the mark with the value 0.67). also mark with the value 0 are above mark with the value 0.67 which is not logical. it is impossible to read this chart.


You can try setting left axis minimum to zero:

Code:
TChart1.Axis.Left.AutomaticMinimum = False
TChart1.Axis.Left.Minimum = 0
that is the problem, the minimum is set to 0 yet we do not see it.
Quote:
BUG_25289_3.jpg) This time there is a 0 value, but it overlaps with the legend


You could use the solution on previous reply or use OnGetAxisLabel event to hide the zero label, for example:

Code:
Private Sub TChart1_OnGetAxisLabel(ByVal Axis As Long, ByVal SeriesIndex As Long, ByVal ValueIndex As Long, LabelText As String)
If Axis = 0 And LabelText = "0" Then
LabelText = ""
End If
End Sub
minimum here i sset to 0 as well yet the chart starts from 1 and the 0 is at the legend. the point is to make the left axis show the bottom chart line at the minimum value (0) and not at 1.

thanks

Posted: Thu May 15, 2008 2:22 pm
by narcis
Hi Zoe,

Tee files may help. We will check them here.

Thanks in advance.

Posted: Thu May 15, 2008 2:49 pm
by 9527011
okay, it will take me a day or two to get the file from our client. I will upload it and update you as soon as i get it.

Thanks,
Zoe.

Posted: Fri May 16, 2008 5:56 pm
by 9527011
Tee files may help. We will check them here.
Hello Again,

I have uploaded 3 tee files (1.tee, 2.tee, 3.tee) which display this problem.

I hope you will manage to see the problem.

Thanks,
Zoe

Posted: Mon May 19, 2008 9:40 am
by narcis
Hi Zoe,

Thanks for the files.

1. I could reproduce the issue here using your file but I'm not able to reproduce it from scratch using code below. Could you please modify the code so that we can reproduce the issue here?

Code: Select all

Private Sub Form_Load()
    TeeCommander1.Chart = TChart1
    
    TChart1.AddSeries scBar
    TChart1.AddSeries scBar
    TChart1.AddSeries scBar
    TChart1.AddSeries scBar
    
    TChart1.Series(0).Add 0, "", clTeeColor
    TChart1.Series(0).Add 0, "", clTeeColor
    
    TChart1.Series(1).Add 0, "", clTeeColor
    TChart1.Series(1).Add 1, "", clTeeColor
    
    TChart1.Series(2).Add 1, "", clTeeColor
    TChart1.Series(2).Add 0, "", clTeeColor
    
    TChart1.Series(3).Add 1, "", clTeeColor
    TChart1.Series(3).Add 1, "", clTeeColor
End Sub
2 and 3. Work fine for me here using TeeChart Pro v7.0.1.4 ActiveX.

Posted: Wed May 28, 2008 10:43 am
by 9527011
Hello again,

I have uploaded a zip file (TeeChartProj.zip) that include a solution of a winform project. the project creates the teechart from scratch. I included two buttons on the form, 1 that set logarithm and shows the problem, and 1 that unset it.

you help would be appreciated.
Zoe.

Posted: Wed May 28, 2008 10:47 am
by 9527011
please use file TeeChartProj2.zip and not the one from previous message. i think the one from previous message was missing something.

thanks

Posted: Wed May 28, 2008 11:06 am
by narcis
Hi Zoe,

Thanks for the example project. It seems to me that it's working fine here using TeeChart Pro v7.0.1.4 ActiveX. Are those the results you expected?

Linear scale:

Image


Logarithmic scale:

Image


Thanks in advance.

Posted: Wed May 28, 2008 11:10 am
by 9527011
Hello,

Minimum left axis value is set to 0 so chart numbers should start from 0. As you can see in the second screen shot (the problematic one), the botton line starts from 1 and not from 0, so the 0.67 mark falls bellow the line. In the first screen shot you can see that the left axis bottom line starts from 0 as it should.

thank you for your fast reply.
Zoe

Posted: Wed May 28, 2008 11:34 am
by narcis
Hi Zoe,

Thanks for the information.

This is because for logarithms values need to be greater than 0 and log(1)=0. In that case you can set left axis minimum to 0.1 when left axis is logarithmic.:

Code: Select all

        private void SetMinMax()
        {
            axTChart1.Axis.Left.Minimum = 0;
            axTChart1.Axis.Left.Maximum = 171;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            axTChart1.Axis.Left.Logarithmic = true;
            axTChart1.Axis.Left.LogarithmicBase = 10;
						axTChart1.Axis.Left.Minimum = 0.1;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            axTChart1.Axis.Left.Logarithmic = false;
						axTChart1.Axis.Left.Minimum = 0;
        }

Posted: Wed May 28, 2008 11:42 am
by 9527011
Thank you very much.

I will pass it on to our users, it seems to be a good solution.