Jump to content
Software FX Community

negative values and list provider data source


User (Legacy)

Recommended Posts

I'm having a problem with the ListProvider datasource in certain situations.

Namely when the list of values in each entry of the ListProvider.List is

length 1 and each value is < 0. Nothing shows on the chart. Here is a very

simple example:

double[] values = { -1000.0 };

ListProvider listProvider = new ListProvider(new ArrayList());

listProvider.List.Add(values);

listProvider.List.Add(values);

listProvider.List.Add(values);

chart1.DataSourceSettings.DataSource = listProvider;

If I change the value to +1000 it works. If I make values an array of >1

elements all negative, it also works.

I'm using:

Win 2000 Pro

ChartFX.dll assembly version 6.2.1342.0

Is this a bug?

-Peter

Link to comment
Share on other sites

Forgot to say I'm using default settings for everything else, ie. a Form

with the chart control dropped onto it and only my code added to the Form

ctor. So gallery is bar chart, etc.

If I do this instead, the results are also "interesting":

double[] values1 = { -1000.0 };

double[] values2 = { -2000.0 };

ListProvider listProvider = new ListProvider(new ArrayList());

listProvider.List.Add(values1);

listProvider.List.Add(values2);

listProvider.List.Add(values1);

chart1.DataSourceSettings.DataSource = listProvider;

This really seems like a bug, no?

"peter z" <pzaborski@nospam.slb.com> wrote in message

news:$Vnps3K3EHA.1120@webserver3.softwarefx.com...

> I'm having a problem with the ListProvider datasource in certain

situations.

> Namely when the list of values in each entry of the ListProvider.List is

> length 1 and each value is < 0. Nothing shows on the chart. Here is a very

> simple example:

>

> double[] values = { -1000.0 };

> ListProvider listProvider = new ListProvider(new ArrayList());

> listProvider.List.Add(values);

> listProvider.List.Add(values);

> listProvider.List.Add(values);

> chart1.DataSourceSettings.DataSource = listProvider;

>

> If I change the value to +1000 it works. If I make values an array of >1

> elements all negative, it also works.

>

> I'm using:

> Win 2000 Pro

> ChartFX.dll assembly version 6.2.1342.0

>

> Is this a bug?

>

> -Peter

>

>

Link to comment
Share on other sites

The problem here is not the negative, the problem is that you have only one 

value.

Chart FX will try to calculate a Min and Max based on your data, by default

the Min is Zero (ForceZero property controls this) and the Max is

undefined. When you set your data these will be adjusted to make it fit.

In your case, when you pass:

double[] values = { -1000.0 };

The Min will be adjusted from Zero to -1000 and so will the Max. So they

will end up being the same. An axis with Min = Max is not displayed since

there is nothing to display (the scale is infinite).

When you set:

double[] values = { 1000.0 };

The Max is adjusted to 1000, and the Min is left at Zero and the Max is set

to 1000. Then the scale is from 0 to 1000 which is good.

--

FP

Software FX

Link to comment
Share on other sites

Thanks for the explanation but...if after parsing the data, Min and Max are

both <0 and ForceZero == true, then shouldn't Max be set to 0?

-Peter

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:SzG5VTT3EHA.1116@webserver3.softwarefx.com...

> The problem here is not the negative, the problem is that you have only

one

> value.

>

> Chart FX will try to calculate a Min and Max based on your data, by

default

> the Min is Zero (ForceZero property controls this) and the Max is

> undefined. When you set your data these will be adjusted to make it fit.

>

> In your case, when you pass:

>

> double[] values = { -1000.0 };

>

> The Min will be adjusted from Zero to -1000 and so will the Max. So they

> will end up being the same. An axis with Min = Max is not displayed since

> there is nothing to display (the scale is infinite).

>

> When you set:

>

> double[] values = { 1000.0 };

>

> The Max is adjusted to 1000, and the Min is left at Zero and the Max is

set

> to 1000. Then the scale is from 0 to 1000 which is good.

>

>

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

The reason I would propose is that the user specifically asked for it by

setting ForceZero to true.

It appears you are enforcing a distinction between + and - values (when

there is only one value per series). So for + values ForceZero works but

for - values ForceZero is seemingly not honored. Note that when there are

multiple - values per series the bar chart draws correctly with no other

changes. ie ForceZero is honored in that case -- why?

For the default chart type (bar) + or - values should not matter. Pie charts

(and similar) are different I agree, - values are not really meaningful

there.

-Peter

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:lMdQGZV3EHA.1116@webserver3.softwarefx.com...

> No. Why zero and not any other value (100, 10, 0.1) ? We leave that choice

> to you by exposing the Min and Max properties.

>

> --

> FP

> Software FX

>

>

Link to comment
Share on other sites

Hmm, I've done a few more tests and see that maybe I was wrong, the

ForceZero property does not work as I stated for multi-value series where

all values are negative. Sorry about that.

Nonetheless, I still think if ForceZero is true then if all values are <0

Max should be 0. Perhaps that will remain only my opinion :)

-Peter

"peter z" <pzaborski@nospam.slb.com> wrote in message

news:2TGn5iV3EHA.1120@webserver3.softwarefx.com...

> The reason I would propose is that the user specifically asked for it by

> setting ForceZero to true.

>

> It appears you are enforcing a distinction between + and - values (when

> there is only one value per series). So for + values ForceZero works but

> for - values ForceZero is seemingly not honored. Note that when there are

> multiple - values per series the bar chart draws correctly with no other

> changes. ie ForceZero is honored in that case -- why?

>

> For the default chart type (bar) + or - values should not matter. Pie

charts

> (and similar) are different I agree, - values are not really meaningful

> there.

>

> -Peter

>

>

> "SoftwareFX Support" <noreply@softwarefx.com> wrote in message

> news:lMdQGZV3EHA.1116@webserver3.softwarefx.com...

> > No. Why zero and not any other value (100, 10, 0.1) ? We leave that

choice

> > to you by exposing the Min and Max properties.

> >

> > --

> > FP

> > Software FX

> >

> >

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...