ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  line chart line multiple colour
Posted by Massimo Brillante on Aug-01-2018 18:04
Hi Peter,

I have to crate a simple line graph chart but the line has to change colours -green, amber, red according to a different range of values. Any example that I can look at or any help will be appreciated as always

  Re: line chart line multiple colour
Posted by Massimo Brillante on Aug-01-2018 23:52
so far I got this but obviously it does not work

double[] DataGreen = new Double[data0Y.Length];
               double[] DataYellow = new Double[data0Y.Length];
               double[] DataRed = new Double[data0Y.Length] ;

               if (data0Y.Length > 0)
               {
                  for (int i = 0; i == data0Y.Length - 1; i++)
                  {
                     DataGreen[i] = Chart.NoValue;
                     DataYellow[i] = Chart.NoValue;
                     DataRed[i] = Chart.NoValue;
                  }

                  for (int i = 0; i <= data0Y.Length - 1; i++)
                  {
                     if(data0Y[i]>=0 && data0Y[1]<=10)
                     {
                        DataGreen[i]=data0Y[i];
                     }

                     else if (data0Y[i] >= 11 && data0Y[1] <= 20)
                     {
                        DataYellow[i] = data0Y[i];
                     }
                     else
                     {
                        DataRed[i] = data0Y[i];
                     }
                  }
               }

                layer0 = c.addLineLayer2();
               layer0.addDataSet(DataGreen, 0x187E03).setDataSymbol(Chart.GlassSphere2Shape, 11);
               layer0.addDataSet(DataYellow, 0xECD36F).setDataSymbol(Chart.GlassSphere2Shape, 11);
               layer0.addDataSet(DataRed, 0xff0000, y0Title).setDataSymbol(Chart.GlassSphere2Shape, 11);

               layer0.setXData(data0X);
               layer0.setLineWidth(3);

  Re: line chart line multiple colour
Posted by Massimo Brillante on Aug-02-2018 00:55
Peter do not worry about this as my colleague Brian find a solution; he also posted on this forum and he is asking about some comments on his solution