Page 1 of 1

Bubble series problem

Posted: Tue Jul 24, 2007 4:05 pm
by 8119968
Dear All,

I have two problems of the bubble series.

1- I would like to have two different colour when radius >0 is blue else red colour. I did use

Code: Select all

buble.ColorEach = true;
but for some reason, in the series, there is a strang colour - green or dark red like that. Very strange. Please advise how to fix this issue.

See this colour error that I meant:

Code: Select all

buble.ColorEach = true;

buble.Add(516295, 1383950, 5000, "1383950", Color.Red);
buble.Add(558722, 1354150, 25000, "1354150", Color.Red);
buble.Add(604955, 1494730, 10000, "1494730", Color.Blue);
buble.Add(156076, 1675080, 5000, "1675080", Color.Red);
2- My radius value is between -30 to +30 and my X and Y are six figure value for Y from 1,300,000 to 1,600,000 and X from -4,000,000 to 7, 000, 000. When I plot there is nothing I can see in the screen due to small radius in the big axis; therefore I fixed this by factoring the radius value based on

Code: Select all

float fltPortion = Math.Abs((fltMaxY - fltMinY) * 1.0f  /(Math.Abs(fltMaxValX) - Math.Abs(fltMinValX)));
radius  = radius * fltPortion;
I then come up with a new radius but some of those bubbles are outside of the X, Y view (some portions of the some bubbles are invisible unless we pan it in or zoom it in). Could you please advise if there is anyway to ensure that all bubbles are always within the X, Y- not half of it are outside the X, and Y so that it's not easy to view. We need full circle buble I mean in the full extent chart view.

Regards,

LG

Posted: Thu Jul 26, 2007 8:22 am
by 9348258
Hi LG
in the series, there is a strang colour - green or dark red like that. Very strange. Please advise how to fix this issue.
Which TeeChart version are you using? Here It's working fine using lastest release (Build 3.2.2746.19160 "available at the web") and also the last release to version 2 (Build 2.0.2652.22325 "available at the web") .
Could you please advise if there is anyway to ensure that all bubbles are always within the X, Y- not half of it are outside the X, and Y so that it's not easy to view
You can fix the min and max values to the Axis, as below code:

Code: Select all

   //You need the min value:
            double min = bubble1[0].X - bubble1.RadiusValues[0];
            for (int i = 1; i < bubble1.Count; i++)
            {
                if (bubble1[i].X - bubble1.RadiusValues[i] < min)
                    min = bubble1[i].X - bubble1.RadiusValues[i];
            }

            //You need the max value
            double max = bubble1[0].X + bubble1.RadiusValues[0];
            for (int i = 1; i < bubble1.Count; i++)
            {
                if (bubble1[i].X + bubble1.RadiusValues[i] > max)
                    max = bubble1[i].X + bubble1.RadiusValues[i];
            }

            tChart1.Axes.Bottom.SetMinMax(Math.Floor(min), Math.Abs(max));

            //The same for the Left Axis, with Y values.

Posted: Thu Jul 26, 2007 8:30 am
by 8119968
Hi Edu,

Many thanks. I am using the version 1.1.1544.23908. Could you please advise?


Regards,

LG

Posted: Thu Jul 26, 2007 9:32 am
by 9348258
Hi LG

I can see that colors with version 1, isn't correct. But it isn't a strange color, I run your code with last version 1 and this is my result: The two first are red, and the two others are blue. I've added it (TF02012363) to our defect list.

I've found a workaround to above bug that I mentioned, but you have to download the last version 1, (Build 1.1.2531.28391 "available at the web"). The workaround is using the GetAxisLabel, as below code:

Code: Select all

private void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
        {
            //This is an example based on your code.
            if (e.ValueIndex == 2) bubble1[e.ValueIndex].Color = Color.Blue;
            else if (e.ValueIndex!=-1) bubble1[e.ValueIndex].Color = Color.Red;
        }

Posted: Thu Jul 26, 2007 4:14 pm
by 8119968
Hi Edu,

Many thanks. Based on your example, in the case that I have hundred of bubble points so that I will not know which are supposed to be red and which are supposed to be blue. In that example you know it, I am not sure if the work around will solve problem.

Is there any generic way of solving this problem?

Best Regards,

LG

Posted: Fri Jul 27, 2007 8:32 am
by 9348258
Hi LG

You can get the radius in "GetAxisLabel" event, as below code, so you only have to change the condition of the "if"

Code: Select all

bubble1.RadiusValues[e.ValueIndex]