Пример #1
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        // getting root
        Graph2D graph = GetNode("Graph2D") as Graph2D;

        graph.autoScale = false;
        graph.logScale  = true;
        graph.SetAxisScale(new Vector2(1970, 2020), new Vector2((float)Math.Pow(10, -1), (float)Math.Pow(10, 8)));

        List <string> cores       = FileToString("Example/Data/microprocessor-trend-data-master/cores.txt");
        List <string> frequency   = FileToString("Example/Data/microprocessor-trend-data-master/frequency.txt");
        List <string> specint     = FileToString("Example/Data/microprocessor-trend-data-master/specint.txt");
        List <string> transistors = FileToString("Example/Data/microprocessor-trend-data-master/transistors.txt");
        List <string> watts       = FileToString("Example/Data/microprocessor-trend-data-master/watts.txt");

        List <Control> coreControls       = graph.AddPoints(StringToPoints(cores));
        List <Control> frequencyControls  = graph.AddPoints(StringToPoints(frequency));
        List <Control> transistorControls = graph.AddPoints(StringToPoints(transistors));
        List <Control> wattControls       = graph.AddPoints(StringToPoints(watts));

        graph.SetColour(coreControls, Constants.Colours[0]);
        graph.SetColour(frequencyControls, Constants.Colours[1]);
        graph.SetColour(transistorControls, Constants.Colours[2]);
        graph.SetColour(wattControls, Constants.Colours[3]);
        graph.xAxis.title.Text = "Year";
        graph.yAxis.title.Text = "Intensity";
        graph.Resize();
    }