Page 1 of 1

SeriesPointCompactColored3D single point color changed

Posted: Wed May 24, 2023 10:19 am
by grey
in View3D PointLineSeries3D,I want change the color of one SeriesPointCompactColored3D in PointLineSeries3D.PointsCompactColored when i click it,I add test code in the demo,but the color not changed unless I resize the window after i click,is it a bug? the code is blow

Code: Select all

            //Add 3D point series
            //Spheres 
            PointLineSeries3D sphereSeries = new PointLineSeries3D(_chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
            sphereSeries.PointStyle.Shape3D = PointShape3D.Sphere;
            sphereSeries.PointStyle.Size3D.SetValues(20, 20, 20);
            //sphereSeries.Material.DiffuseColor = Colors.Teal;
            //sphereSeries.Material.SpecularColor = Colors.Gray;
            //sphereSeries.Material.SpecularPower = 20;
            //sphereSeries.PointStyle.DetailLevel = 100;
            sphereSeries.IndividualPointColors = true;
            sphereSeries.AllowUserInteraction = true;
            sphereSeries.PointsType = PointsType3D.CompactPointsColor;
            sphereSeries.LineVisible = false;
            int defaultColor = -2987746;
            sphereSeries.PointsCompactColored = new SeriesPointCompactColored3D[] {
                new SeriesPointCompactColored3D(50, 50, 50,defaultColor),
                new SeriesPointCompactColored3D(30, 50, 20,defaultColor),
                new SeriesPointCompactColored3D(80, 50, 80, defaultColor)
            };
            sphereSeries.MouseClick += SphereSeries_MouseClick;
            _chart.View3D.PointLineSeries3D.Add(sphereSeries);

Code: Select all

        private void SphereSeries_MouseClick(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (sender is PointLineSeries3D compactSeries)
            {
                int selectColor = -65536;
                int hitIndex = compactSeries.LastHitTestIndex;
                compactSeries.PointsCompactColored[hitIndex].Color = selectColor;
            }
        }
int the image,the red ball is changed color after i click it and resize the window

Re: SeriesPointCompactColored3D single point color changed

Posted: Wed May 24, 2023 12:32 pm
by ArctionKestutis
Chart is automatically update if you change Property of the chart. If you change just individual item in array or just field in the structure, then you should inform chart about need to refresh data. Call Series.InvalidateData() after you modified color.

Re: SeriesPointCompactColored3D single point color changed

Posted: Thu May 25, 2023 2:10 am
by grey
ArctionKestutis wrote: Wed May 24, 2023 12:32 pm Chart is automatically update if you change Property of the chart. If you change just individual item in array or just field in the structure, then you should inform chart about need to refresh data. Call Series.InvalidateData() after you modified color.
Thanks