BarSeries3D incorrect bar positions

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
0uss
Posts: 16
Joined: Mon Apr 18, 2016 5:05 pm

BarSeries3D incorrect bar positions

Post by 0uss » Mon Apr 18, 2016 5:18 pm

Hi everybody,

I'm writing some code to display BarSeries3D in a certain order. I Have multiple series of 12 values that have the same ZAxis coordinate. (Each 12 values are in the same ZAxis coordiante)
This is the code I wrote (I used the ExampleHorizontalBars3D.cs as a base I made some modifications)

Code: Select all

public void createChart3D()
        {
            try
            {
                lightningChartUltimate3.BeginUpdate();
                for (int i = 0; i < table3D.Rows.Count; i++)
                {
                    for (int j = 0; j < 12; j++)
                    {
                        //Chart A results
                        BarSeries3D barSeriesChartA = new BarSeries3D(lightningChartUltimate3.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
                        barSeriesChartA.Title.Text = "";
                        lightningChartUltimate3.View3D.BarSeries3D.Add(barSeriesChartA);
                        barSeriesChartA.Values = new BarSeriesValue3D[] { new BarSeriesValue3D(j, Math.Round(Convert.ToDouble(table3D.Rows[i].ItemArray[j])), i, "") };
                        barSeriesChartA.Material.DiffuseColor = Color.Green;
                        barSeriesChartA.Material.AmbientColor = Color.Green;
                        barSeriesChartA.Material.EmissiveColor = Color.Green;
                        barSeriesChartA.Material.SpecularColor = Color.Green;

                        //SET THE ALARMS
                        if (Convert.ToDouble(DtPreAl.Rows[0].ItemArray[i]) <= Convert.ToDouble(table3D.Rows[i].ItemArray[j]))
                        {
                            barSeriesChartA.Material.DiffuseColor = Color.Yellow;
                            barSeriesChartA.Material.AmbientColor = Color.Yellow;
                            barSeriesChartA.Material.EmissiveColor = Color.Yellow;
                            barSeriesChartA.Material.SpecularColor = Color.Yellow;
                        }

                        if (Convert.ToDouble(DtAl.Rows[0].ItemArray[i]) <= Convert.ToDouble(table3D.Rows[i].ItemArray[j]))
                        {
                            barSeriesChartA.Material.DiffuseColor = Color.Orange;
                            barSeriesChartA.Material.AmbientColor = Color.Orange;
                            barSeriesChartA.Material.EmissiveColor = Color.Orange;                          
                            barSeriesChartA.Material.SpecularColor = Color.Orange;
                        }

                        if (Convert.ToDouble(DtDg.Rows[0].ItemArray[i]) <= Convert.ToDouble(table3D.Rows[i].ItemArray[j]))
                        {
                            barSeriesChartA.Material.DiffuseColor = Color.Red;
                            barSeriesChartA.Material.AmbientColor = Color.Red;
                            barSeriesChartA.Material.EmissiveColor = Color.Red;
                            barSeriesChartA.Material.SpecularColor = Color.Red;
                        }
                    }
                }

                //Set similar properties for all series
                foreach (BarSeries3D bs in lightningChartUltimate3.View3D.BarSeries3D)
                {
                    bs.DetailLevel = 100;
                    bs.BaseLevel = 0;
                    bs.Material.SpecularColor = Color.LightGray;
                    bs.ValueLabelSettings.Visible = true;
                    bs.ValueLabelSettings.WorldOffset.Y = 3;
                }
                lightningChartUltimate3.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }
        }
In the attachement you can see the result I have in the 3D. What I want to do is display a Waterfall of the first graph, many series of 12 values displayed in 3D graph.

Thank you in advance for your help :)
Attachments
3D.png
3D.png (76.22 KiB) Viewed 8060 times

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: BarSeries3D incorrect bar positions

Post by ArctionPasi » Mon Apr 18, 2016 6:19 pm

Hello,

I didn't quite understand what you are trying to achieve... You can position each of the bar series bars invidually, so you can position them pretty much where ever you want... Is the problem in your picture that the bars are moving back as X increases?

http://arction.com/download/lightningch ... manual.pdf, section 6.11 BarSeries3D explains grouping. Maybe Manhattan type is what you are after?
LightningChart Support Team, PT

0uss
Posts: 16
Joined: Mon Apr 18, 2016 5:05 pm

Re: BarSeries3D incorrect bar positions

Post by 0uss » Mon Apr 18, 2016 6:52 pm

Hi,

Thank you very much for your response. Exactly, my problem is that the bars are moving back as X inscreases. In the code there is nothing like that: I'm using the same X value for each 12 bars.
And yes I'm positionning each bar individually as shown in my code.

I'll take a look at the grouping section of the manual.

Thank you again.

0uss
Posts: 16
Joined: Mon Apr 18, 2016 5:05 pm

Re: BarSeries3D incorrect bar positions

Post by 0uss » Tue Apr 19, 2016 2:02 pm

Hi again,

I've made some progress with my project but I'm still not able to achieve what I want to do. I used all sorts of BarGrouping as suggested and here are all the results I'm having.
But my bars are still moving back even if they have the SAME Z Axis value as shown in the code.
  • Using Manhattan as BarGrouping option makes my bars move back. (Correct X Values, incorrect Z values)
  • Using GroupedIndexedFitWidth as BarGrouping option makes my bars move to the right. There is some sort of shift applied to the second set of bars. (Correct Z values, incorrect X values)
The code is below and the results are attached.

Code: Select all

        public void createChart3D()
        {
            try
            {
                chartOCT3D.BeginUpdate();

                Double dViewHeight = chartOCT3D.View3D.Dimensions.X;
                Double dBarSpacing = 0.1;
                Double dBarThickness = dViewHeight / 12 - dBarSpacing;

                for (int i = 0; i < table3D.Rows.Count; i++)
                {
                    for (int j = 0; j < 12; j++)
                    {
                        //Chart A results
                        BarSeries3D barSeriesChartA = new BarSeries3D(chartOCT3D.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
                        barSeriesChartA.Title.Text = "";
                        chartOCT3D.View3D.BarSeries3D.Add(barSeriesChartA);
                        [b][u]barSeriesChartA.Values = new BarSeriesValue3D[] { new BarSeriesValue3D((Double)j + 0.5, Math.Round(Convert.ToDouble(table3D.Rows[i].ItemArray[j])), i + 0.5, "") };[/u][/b]
                        barSeriesChartA.Material.DiffuseColor = Color.DarkGreen;
                        barSeriesChartA.Material.AmbientColor = Color.DarkGreen;
                        barSeriesChartA.Material.EmissiveColor = Color.DarkGreen;
                        barSeriesChartA.Material.SpecularColor = Color.DarkGreen;
                        barSeriesChartA.BarWidth = dBarThickness;
                        barSeriesChartA.BarDepth = dBarThickness;

                        //SET THE ALARMS
                        if (Convert.ToDouble(DtPreAl.Rows[0].ItemArray[j]) <= Convert.ToDouble(table3D.Rows[i].ItemArray[j]))
                        {
                            barSeriesChartA.Material.DiffuseColor = Color.Yellow;
                            barSeriesChartA.Material.AmbientColor = Color.Yellow;
                            barSeriesChartA.Material.EmissiveColor = Color.Yellow;
                            barSeriesChartA.Material.SpecularColor = Color.Yellow;
                        }

                        if (Convert.ToDouble(DtAl.Rows[0].ItemArray[j]) <= Convert.ToDouble(table3D.Rows[i].ItemArray[j]))
                        {
                            barSeriesChartA.Material.DiffuseColor = Color.DarkOrange;
                            barSeriesChartA.Material.AmbientColor = Color.DarkOrange;
                            barSeriesChartA.Material.EmissiveColor = Color.DarkOrange;
                            barSeriesChartA.Material.SpecularColor = Color.DarkOrange;
                        }

                        if (Convert.ToDouble(DtDg.Rows[0].ItemArray[j]) <= Convert.ToDouble(table3D.Rows[i].ItemArray[j]))
                        {
                            barSeriesChartA.Material.DiffuseColor = Color.Red;
                            barSeriesChartA.Material.AmbientColor = Color.Red;
                            barSeriesChartA.Material.EmissiveColor = Color.Red;
                            barSeriesChartA.Material.SpecularColor = Color.Red;
                        }
                    }
                }

                //Set similar properties for all series
                foreach (BarSeries3D bs in chartOCT3D.View3D.BarSeries3D)
                {
                    bs.ValueLabelSettings.Visible = true;
                    bs.ValueLabelSettings.WorldOffset.Y = 3;
                }
                chartOCT3D.View3D.ZAxisPrimary3D.SetRange(0, table3D.Rows.Count);
                chartOCT3D.View3D.XAxisPrimary3D.SetRange(0, 12.5);
                chartOCT3D.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show(ex.Message);
            }
        }
Thank you very much for your help.
Attachments
GroupedIndexedFitWidth
GroupedIndexedFitWidth
GroupedIndexedFitWidth.png (40.92 KiB) Viewed 8042 times
Manhattan
Manhattan
manhatten.png (45.77 KiB) Viewed 8042 times
groupedByXValues
groupedByXValues
groupedByXValues.png (39.93 KiB) Viewed 8042 times

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: BarSeries3D incorrect bar positions

Post by ArctionPasi » Tue Apr 19, 2016 3:13 pm

I made a new bars project, and it really seems it's not currently possible to do it like you want. It would work otherwise but we would have to modify LC to
- have individual color for each bar value. Now the whole bar series is of same color. Manhattan would work nicely then.
or
- having Grouping = None where individual bars could be arbitrary positions dispite of any grouping matters.

I have a couple of alternative approaches, I think you want to set some of coloring based on the value. Red = high value, Yellow = Mid value and Green = Low value?
1. Use WaterfallSeries3D.
Waterfall series
Waterfall series
waterfall.jpg (255 KiB) Viewed 8035 times
2. Use SurfaceMeshSeries3D to compose bars. Then you can color each bar individually, or by palette coloring as shown here:
Bars made with surface mesh series
Bars made with surface mesh series
BarsWithSurfaceMeshSeries3D.jpg (198.63 KiB) Viewed 8035 times
You support subscription in not valid, so we'll keep the support efforts in minimum from now on.
LightningChart Support Team, PT

0uss
Posts: 16
Joined: Mon Apr 18, 2016 5:05 pm

Re: BarSeries3D incorrect bar positions

Post by 0uss » Tue Apr 19, 2016 3:42 pm

Thank you for your reply,

It's precisely the problem I have : I need to color each bar of the same series depending on the value of the bar. But unfortunately that's not possible and Manhattan would work really nice as shown in the samples of LC.
So I have to work with each bar individually and that's giving me "random" positions.

I will try now the SurfaceMeshSeries3D to compose the bars.

Than you again for the answers :)

I'll be back with the solution if it's working as I want.

Post Reply