private async void button2_Click(object sender, EventArgs e)
        {
            //Show the graphs for location
            chart1.Visible = false;
            chart2.Visible = false;
            chart3.Visible = true;
            chart3.Series.FindByName("LocationAir").Points.Clear();
            chart4.Visible = true;
            chart4.Series.FindByName("LocationDust").Points.Clear();

            int i = 0;

            while (true)
            {
                i++;
                FirebaseResponse airResponse = await client.GetTaskAsync("Air/" + i);

                if (airResponse.Body == "null")
                {
                    return;
                }

                Air      airObj  = airResponse.ResultAs <Air>();
                DateTime airTime = DateTime.ParseExact(airObj.Time, "HH:mm:ss", CultureInfo.InvariantCulture);
                chart3.Series.FindByName("LocationAir").Points.AddXY(airTime, airObj.SensorValue);

                FirebaseResponse dustResponse = await client.GetTaskAsync("Dust/" + i);

                if (dustResponse.Body == "null")
                {
                    return;
                }

                Dust     dustObj  = dustResponse.ResultAs <Dust>();
                DateTime dustTime = DateTime.ParseExact(dustObj.Time, "HH:mm:ss", CultureInfo.InvariantCulture);
                chart4.Series.FindByName("LocationDust").Points.AddXY(dustTime, dustObj.Concentration);
            }
        }
        private async void displayData(string output)
        {
            //hide all icons from previous tab
            chart1.Visible = true;
            chart2.Visible = true;

            var airObj  = new Air {
            };
            var dustObj = new Dust {
            };

            //air properties
            String airReading  = "";
            String sensorValue = "";
            String airQuality  = "";

            //dust properties
            String LPO           = "";
            String ratio         = "";
            String concentration = "";

            //hardcode the id from firebase here
            ++i;
            String firebaseId = i + "";

            try
            {
                //skip first reading as it may not be accurate due to device reading the previous data still (not cleaned)
                if (counter != 0)
                {
                    output = serialPort1.ReadLine();/// -Same as serialPort1.ReadTo("\n");
                    //textBox1.AppendText(output + "\n");

                    int      wordCounter = 0;
                    string[] result      = output.Split('/');
                    foreach (string value in result)
                    {
                        if (wordCounter == 0)
                        {
                            //air quality
                            int    airPollution = value.IndexOf(',');
                            String air          = value.Substring(0, airPollution);
                            airReading = air;
                            if (air.Equals("4"))
                            {
                                airQuality = "Fresh air";
                            }
                            else if (air.Equals("3"))
                            {
                                airQuality = "Low pollution";
                            }
                            else if (air.Equals("2"))
                            {
                                airQuality = "High pollution";
                            }
                            else if (air.Equals("1"))
                            {
                                airQuality = "High pollution! Force signal active.";
                            }
                            else
                            {
                                airQuality = "Unknown";
                            }

                            sensorValue = value.Substring(airPollution + 1);

                            airObj = new Air
                            {
                                ID           = ++i + "",
                                AirReading   = airReading,
                                SensorValue  = sensorValue,
                                AirQuality   = airQuality,
                                LocationID   = "",
                                LocationName = "SIS SR 3-2",
                                Time         = DateTime.Now.ToString("HH:mm:ss")
                            };
                        }
                        else
                        {
                            //dust quality in terms of loc, ratio, concentration
                            int    slash     = value.IndexOf('/');
                            String dustValue = value.Substring(slash + 1);
                            int    locNo     = dustValue.IndexOf(",");
                            LPO = dustValue.Substring(0, locNo);
                            int r = dustValue.IndexOf(",", locNo + 1);
                            ratio = dustValue.Substring(locNo + 1, 3); //currently hardcode to 3
                            int c = dustValue.LastIndexOf(",");
                            concentration = dustValue.Substring(c + 1);

                            dustObj = new Dust
                            {
                                ID            = ++i + "",
                                LPO           = LPO,
                                Ratio         = ratio,
                                Concentration = concentration,
                                LocationID    = "",
                                LocationName  = "SIS SR 3-2",
                                Time          = DateTime.Now.ToString("HH:mm:ss")
                            };
                        }
                        wordCounter++;
                    }

                    //populate the graphs
                    chart1.Series.FindByName("Air").Points.AddY(Double.Parse(sensorValue));
                    chart2.Series.FindByName("Dust").Points.AddY(Double.Parse(concentration));

                    //send air data
                    SetResponse airResponse = await client.SetTaskAsync("Air/" + firebaseId, airObj);

                    //send dust data
                    SetResponse dustResponse = await client.SetTaskAsync("Dust/" + firebaseId, dustObj);

                    airQuality = "";
                    counter++;
                }
            }
            catch
            {
                MessageBox.Show("There was an error. Please make sure that the correct port was selected, and the device, plugged in.");
            }
            counter++;
        }