Пример #1
0
    // Use this for initialization
    void Start()
    {
        GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab);

        graphGO.transform.SetParent(this.transform, false);
        graph = graphGO.GetComponent <WMG_Axis_Graph>();

        graph.stretchToParent(graphGO);

        graph.Init();
        graph.graphType = WMG_Axis_Graph.graphTypes.line_stacked;
        graph.useGroups = true;

        List <string> groups = new List <string>()
        {
            "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"
        };

        graph.groups.SetList(groups);

        for (int i = 0; i < numSeries; i++)
        {
            WMG_Series series = graph.addSeries();
            series.lineColor              = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1);
            series.pointColor             = series.lineColor;
            series.UseXDistBetweenToSpace = true;
            int numPoints = Random.Range(maxNumPoints / 2, maxNumPoints);
            series.pointValues.SetList(WMG_Util.GenRandomY(numPoints, maxNumPoints - numPoints + 1, maxNumPoints, graph.yAxis.AxisMinValue / numSeries, graph.yAxis.AxisMaxValue / numSeries));
        }
    }
    // Use this for initialization
    void Start()
    {
        GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab);

        graphGO.transform.SetParent(this.transform, false);
        graph = graphGO.GetComponent <WMG_Axis_Graph>();

        graph.stretchToParent(graphGO);

        graph.xAxis.AxisMinValue         = 0;
        graph.yAxis.AxisMinValue         = 0;
        graph.xAxis.AxisMaxValue         = 100;
        graph.yAxis.AxisMaxValue         = 100;
        graph.legend.hideLegend          = true;
        graph.xAxis.SetLabelsUsingMaxMin = true;
        graph.xAxis.LabelType            = WMG_Axis.labelTypes.ticks;

        graph.autoAnimationsEnabled = true;

        series1            = graph.addSeries();
        series1.hidePoints = true;
        series1.lineScale  = 0.4f;
        if (useComputeShader)
        {
            series1.areaShadingTextureResolution = 4096;
            if (drawAreaShading)
            {
                series1.areaShadingType = WMG_Series.areaShadingTypes.Gradient;
                series1.areaShadingUsesComputeShader = true;
                series1.areaShadingColor             = Color.blue;
                series1.areaShadingAxisValue         = 0;
            }
            series1.linesUseComputeShader = true;
            series1.neverCreateLines      = true;
            series1.neverCreatePoints     = true;
        }
        else
        {
            series1.LineCreated  += groupLinesInCanvases;
            series1.PointCreated += groupPointsInCanvases;
        }
        series1.pointValues.SetList(WMG_Util.GenRandomY(numPointsToCreate, 0, 100, 0, 100));
    }