How to color the area between a line and the vertical axis?


Author
Message
peck 110
peck 110
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)
Group: Forum Members
Posts: 5, Visits: 1
I want to color the area between a line and the vertical axis.when i use the series type "area",it always color the area between the line and the horizontal axis. there may be easy to meet my need,please help me !
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi,

The following example displays a chart similar to the one that you sent us. If you send us the real data we can modify the example to work with it.


      private void Form1_Load(object sender, EventArgs e)
      {
         NChart chart = nChartControl1.Charts[0];
         chart.SetPredefinedChartStyle(PredefinedChartStyle.HorizontalLeft);
         chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();

         // Setup line series
         double[] lineValuesY = new double[] { 35, 32, 30, 30, 31, 34, 39, 43, 47, 47, 46 };
         double[] lineValuesX = new double[] { 15, 17, 21, 22, 24, 27, 27, 27, 25, 23, 20 };

         NLineSeries line = new NLineSeries();
         chart.Series.Add(line);
         line.UseXValues = true;
         line.DataLabelStyle.Visible = false;
         line.MarkerStyle.Visible = true;
         line.MarkerStyle.PointShape = PointShape.Ellipse;
         line.Values.AddRange(lineValuesY);
         line.XValues.AddRange(lineValuesX);

         // Setup area series
         NAreaSeries area = new NAreaSeries();
         chart.Series.Add(area);
         area.UseXValues = true;
         area.DataLabelStyle.Visible = false;

         double[] areaValues = new double[] { 10, 20, 15, 23, 23, 23, 45, 11 };

         for (int i = 0; i < areaValues.Length; i++)
         {
            double value = areaValues[i];
            double xvalue1 = i * 5;
            double xvalue2 = (i + 1) * 5;

            area.Values.Add(value);
            area.XValues.Add(xvalue1);

            area.Values.Add(value);
            area.XValues.Add(xvalue2);
         }
      }


Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search