Profile Picture

A bug in NPalette?

Posted By Hans Henrik Friis Pedersen... 9 Years Ago
Author
Message
Hans Henrik Friis Pedersen...
Question Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 28, Visits: 136
Hi,

When trying to make a custom NPalette, then at a value of 100 the palette is always blue eventhough I state a color of red??

See the code below and the attached graph..If I "reverse" the Palette with other colors; then there is no problems (see code below)


private void Form1_Load(object sender, EventArgs e)
        {
            NChart chart = (NChart)(nChartControl1.Charts[0]);
            chart.Series.Clear();
            nChartControl1.Legends.Clear();
            chart.BoundsMode = BoundsMode.Stretch;
            chart.Size = new NSizeL(new NLength(70.0f, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage));
 
            //chart.DockMode = PanelDockMode.
 
 
            NLegend legend = new NLegend();
            //legend.Header.Text = "Agubsa!!";
            //legend.Header.
            legend.Mode = LegendMode.Manual;
            legend.Size = new NSizeL(new NLength(40.0f, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage));
            legend.Data.ExpandMode = LegendExpandMode.VertWrap;
            legend.DockMode = PanelDockMode.Right;
            legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right);
            legend.Margins = new NMarginsL(20, 20, 20, 20);
            //chart.ChildPanels.Add(legend);
            legend.BoundsMode = BoundsMode.Fit;
           
            nChartControl1.Panels.Add(legend);
 
            NPalette palette = new NPalette();
            /*
            int i = 0;
            for (i = 0; i <= 10; i++)
            {
                palette.Add(i*10,CoolColorCode(i*10.0));
            }
            */
            palette.Add(0, Color.Blue);
            palette.Add(10, Color.LightBlue);
            palette.Add(20, Color.LimeGreen);
            palette.Add(30, Color.Green);
            palette.Add(40, Color.LightYellow);
            palette.Add(50, Color.Yellow);
            palette.Add(60, Color.Orange);
            palette.Add(70, Color.LightPink);
            palette.Add(80, Color.Red);
            palette.Add(90, Color.Red);
            palette.Add(100, Color.Red);
 
            palette.Mode = PaletteMode.Custom;
            palette.SmoothPalette = true;
 
            NLegendPaletteCellData m_PaletteCellData;
            m_PaletteCellData = new NLegendPaletteCellData(palette, new NRange1DD(0, 100));
 
            m_PaletteCellData.TextStyle.FontStyle = new NFontStyle("Arial", 13);
 
            NNumericScaleConfigurator paletteScale = m_PaletteCellData.PaletteScaleConfigurator as NNumericScaleConfigurator;
            paletteScale.LabelValueFormatter = new NNumericValueFormatter("##0.0");
            paletteScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.RemoveOverlap};
 
            legend.Data.Items.Add(m_PaletteCellData);
 
            nChartControl1.Refresh();
 
        }




This code seems to work:

   

           palette.Add(100, Color.Blue);
            palette.Add(90, Color.LightBlue);
            palette.Add(80, Color.LimeGreen);
            palette.Add(70, Color.Green);
            palette.Add(60, Color.LightYellow);
            palette.Add(50, Color.Yellow);
            palette.Add(40, Color.Orange);
            palette.Add(30, Color.LightPink);
            palette.Add(20, Color.Red);
            palette.Add(10, Color.Red);
            palette.Add(0, Color.Red);




Attachments
Untitled3.png (286 views, 5.00 KB)



Similar Topics


Reading This Topic