Ejemplo n.º 1
0
        public void OnAddEntryClick()
        {
            int x = IntFromText(xInputField.text);
            int y = IntFromText(yInputField.text);

            chart.GetChartData().DataSets[0].AddEntry(new BarEntry(x, y));
            chart.SetDirty();
        }
        private void AddChartData()
        {
            BarDataSet set1 = new BarDataSet("Data Set 1");

            set1.AddEntry(new BarEntry(0, 100));
            set1.AddEntry(new BarEntry(1, 50));
            set1.AddEntry(new BarEntry(2, 70));
            set1.AddEntry(new BarEntry(3, 130));
            set1.AddEntry(new BarEntry(4, 150));

            set1.BarColors.Add(new Color32(125, 163, 161, 255));

            BarDataSet set2 = new BarDataSet("Data Set 2");

            set2.AddEntry(new BarEntry(0, 80));
            set2.AddEntry(new BarEntry(1, 110));
            set2.AddEntry(new BarEntry(2, 75));
            set2.AddEntry(new BarEntry(3, 90));
            set2.AddEntry(new BarEntry(4, 130));

            set2.BarColors.Add(new Color32(52, 103, 93, 255));

            List <string> labels = new List <string>();

            labels.Add("Mon");
            labels.Add("Tue");
            labels.Add("Wed");
            labels.Add("Thu");
            labels.Add("Fri");

            chart.GetChartData().CustomLabels = labels;
            chart.GetChartData().DataSets.Add(set1);
            chart.GetChartData().DataSets.Add(set2);

            chart.SetDirty();
        }