Montag, 4. November 2013

C# Chart Control

Chart Control -- Problems


Using the C# Chart Control i stumbled across a lot of problems. For example i can`t divide between X and Y values the data will always be displayed at both the x Axis and the y Axis even though i used 3 different methods.

  
 

private void fillButton_Click(object sender, EventArgs e)
        {
            Random rnd1 = new Random();

            int[] xaxis1;
            int[] xaxis2;
            int[] xaxis3;
            xaxis1 = new int[10];
            xaxis2 = new int[10];
            xaxis3 = new int[15];

            for (int i = 0; i < 5; i++)

            {
                xaxis1[i] = i*2;
            }

            toprightChart.DataSource = xaxis1;
            toprightChart.Series[0].XValueMember = "Y";
            toprightChart.Series[0].YValueMembers = "X";
            toprightChart.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            toprightChart.DataBind();

            for (int j = 0; j < 10; j++)
            {
                xaxis2[j] = rnd1.Next(0, 10);
            }

            bottomleftChart.DataSource = xaxis2;
            bottomleftChart.Series[0].XValueMember = "Y";
            bottomleftChart.Series[0].YValueMembers = "X";
            bottomleftChart.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            bottomleftChart.DataBind();

            List<double> chartData = new List<double>();

            for (int k = 0; k < 5; k++)
            {
                chartData.Add(rnd1.Next(0, 10));
            }

            bottomrightChart.DataSource = chartData;
            bottomrightChart.Series[0].XValueMember = "Y";
            bottomrightChart.Series[0].YValueMembers = "X";
            bottomrightChart.ChartAreas["ChartArea1"].AxisX.Interval = 1;
            bottomrightChart.DataBind();
        }


After those problems are solved there should be a focus at real time charts and the serial connection to the Arduino.

Worked (13h) + 3h = 16h

Keine Kommentare:

Kommentar veröffentlichen