0

I have a chart where different signals are being plotted. I want to create a button, that when the user presses it , a new chart area is created.

 int clicks = 0;


    List<ChartArea> Areas = new List<ChartArea>();
    
    private void button2_Click(object sender, EventArgs e)
    {
        clicks++;
        for (int i=0; i<clicks; i++)
        {
            Areas.Add(new ChartArea());
            Areas[i].Visible = true;
           
        }

But nothing seems to happen.

nickolas
  • 121
  • 7
  • And what do you expect to happen? You don't add any points to display, see [relevant question](https://stackoverflow.com/q/10622674/1997232). – Sinatr Apr 07 '21 at 10:27
  • I don't want to display any points at first place. I want to show that there are two different chart areas, with grids etc. And then the user will decide where to display what. – nickolas Apr 07 '21 at 10:29
  • Where `Areas` field is used? How is it connected to a chart in form? – Sinatr Apr 07 '21 at 10:30
  • One method is to create a Panel. Then add each chart as a child panel in the main panel. A panel has four properties 1) Left 2) Top 3) Width 4)Height. The child panels are referenced to the the TOP left corner of the Main Panel which is (0,0) and the y positive direction goes down and the x positive direction goes right. As you add child panels you want to make sure they do not overlap each other. – jdweng Apr 07 '21 at 10:31

0 Answers0