public override void Init(ManagerBase manager)
    {
        base.Init(manager);
        Subscribe((int)MessageUIConst.OpenProductDetailPanel, (arg) =>
        {
            Control(arg);
        });

        costGraph.Init();
        costGraph.yAxis.LabelType          = WMG_Axis.labelTypes.ticks;
        costGraph.yAxis.MaxAutoGrow        = true;
        costGraph.yAxis.AxisNumTicks       = 6;
        costGraph.yAxis.AxisMaxValue       = 1;
        costGraph.tooltipDisplaySeriesName = true;
        costGraph.xAxis.AxisNumTicks       = 12;

        costS1 = costGraph.addSeries();
        costS1.UseXDistBetweenToSpace = true;
        costS1.seriesName             = "固定成本";
        costS2 = costGraph.addSeries();
        costS2.UseXDistBetweenToSpace = true;
        costS2.seriesName             = "非固定成本";
        costS1.pointColor             = Color.red;
        costS2.pointColor             = Color.green;

        IsON = false;
        gameObject.SetActive(IsON);
    }
Beispiel #2
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));
        }
    }
    public override void SetData()
    {
        graph.Init();
        graph.groups.SetList(dataNameList);
        WMG_Series s1 = graph.lineSeries[0].GetComponent <WMG_Series>();

        //设置计量条的值,该值为数据列表中 产品质量列表 的值
        List <Vector2> s1datalist = new List <Vector2>();

        for (int i = 0; i < dataPassRateList.Count; i++)
        {
            s1datalist.Add(new Vector2(i + 1, dataPassRateList[i]));
        }
        s1.pointValues.SetList(s1datalist);

        //创建字典,该字典为<节点(即计量条),id>字典,目的是保存每一个计量条所对应的产品id,为了点击计量条时所弹出的窗口传参
        WMG_Node[] nodes = s1.nodeParent.GetComponentsInChildren <WMG_Node>();
        for (int i = 0; i < dataIdList.Count; i++)
        {
            if (!nodesDic.ContainsKey(nodes[i]))
            {
                nodesDic.Add(nodes[i], dataIdList[i]);
            }
        }
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        //her kommer tillegg
        zpots = Field.Spots;


        //waterMM = zpots[0, 0].WaterMM;


        //air = zpots[0, 0].Air;



        GameObject graphGO = GameObject.Instantiate(emptyGraphPrefab);

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

        series1 = graph.addSeries();

        graph.xAxis.AxisMaxValue = 28;

        if (useData2)
        {
            List <string>  groups = new List <string>();
            List <Vector2> data   = new List <Vector2>();
            for (int i = 0; i < series1Data2.Count; i++)
            {
                string[] row = series1Data2[i].Split(',');
                groups.Add(row[0]);
                if (!string.IsNullOrEmpty(row[1]))
                {
                    float y = float.Parse(row[1]);
                    data.Add(new Vector2(i + 1, y));
                }
            }

            graph.groups.SetList(groups);
            graph.useGroups = true;

            graph.xAxis.LabelType    = WMG_Axis.labelTypes.groups;
            graph.xAxis.AxisNumTicks = groups.Count;

            series1.seriesName = "Fruit Data";

            series1.UseXDistBetweenToSpace = true;

            series1.pointValues.SetList(data);

            graph.Refresh();
        }
        else
        {
            series1.pointValues.SetList(series1Data);
        }
    }    //Start()
    // Use this for initialization
    void Start()
    {
        graph.Init();          // ensure graph Start() method called before this Start() method
        GameObject toolTipPanel = GameObject.Instantiate(tooltipPrefab);

        toolTipPanel.transform.SetParent(canvasGO.transform, false);
        GameObject toolTipLabel = toolTipPanel.transform.GetChild(0).gameObject;

        graph.theTooltip.SetTooltipObject(toolTipPanel, toolTipLabel);
    }
Beispiel #6
0
    // create graph gameobject, save Axis Graph and add world space and series
    void InitializeGraph()
    {
        GameObject graphGO = base.InstantiateGraph();

        graph = graphGO.GetComponent <WMG_Axis_Graph>();
        graph.Init();
        AddWorldSpaceScript();
        AddGraphSeries();
        yLabels = GetLabels('y');
    }
Beispiel #7
0
    public override void Init(ManagerBase manager)
    {
        base.Init(manager);

        Subscribe((int)MessageUIConst.OpenPassRateDetailPanel, (arg) =>
        {
            Control(arg);
        });

        IsON = false;
        gameObject.SetActive(IsON);

        graph.Init();
        graph.yAxis2.AxisLine.SetActive(false);
    }
Beispiel #8
0
 // Use this for initialization
 void Start()
 {
     graph.Init();          // ensure graph Start() method called before this Start() method
     graph.theTooltip.SetTooltipObject(toolTipPanel, toolTipLabel);
 }
Beispiel #9
0
    // Use this for initialization
    void Start()
    {
        GameObject lineGraphObj = Instantiate <WMG_Axis_Graph>(lineGraphPrefab).gameObject;

        lineGraphObj.transform.SetParent(GameObject.Find("Canvas").transform, worldPositionStays: false);
        lineGraphObj.transform.localPosition = Vector3.zero;
        lineGraphObj.transform.localScale    = Vector3.one * 0.7f;
        lineGraphObj.GetComponent <RectTransform>().sizeDelta = lineGraphObj.transform.parent.GetComponent <RectTransform>().rect.size *0.3f; //全屏
        lineGraph = lineGraphObj.GetComponent <WMG_Axis_Graph>();
        lineGraph.Init();

        WMG_List <Vector2> pointPosGZ = new WMG_List <Vector2>()
        {
            new Vector2(1f, 3f), new Vector2(2f, 20f), new Vector2(3f, 4f),
            new Vector2(4f, 13f), new Vector2(5f, 1f), new Vector2(6f, 4f), new Vector2(7f, 16f), new Vector2(8f, 5f), new Vector2(9f, 11f), new Vector2(10, 4f),
            new Vector2(11, 6f), new Vector2(12, 7f)
        };
        WMG_List <Vector2> pointPosSZ = new WMG_List <Vector2> {
            new Vector2(1f, 16f), new Vector2(2f, 5f), new Vector2(3f, 11f), new Vector2(4, 4f),
            new Vector2(5, 6f), new Vector2(6, 7f), new Vector2(7f, 6), new Vector2(8f, 12f), new Vector2(9f, 7f), new Vector2(10, 15f),
            new Vector2(11, 12f), new Vector2(12, 3f)
        };
        WMG_List <string> lineGroups = new WMG_List <string>()
        {
            "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
        };

        //  WMG_List<Color> lineColor = new WMG_List<Color>() { Color.red, Color.yellow, Color.green, Color.blue, Color.cyan, Color.black };
        lineGraph.useGroups = true;
        lineGraph.groups.SetList(lineGroups);
        lineGraph.xAxis.axisLabels.SetList(lineGroups);
        //lineGraph.lineSeries = new List<GameObject>();
        lineGraph.lineSeries[0].GetComponent <WMG_Series>().pointValues = pointPosGZ;
        lineGraph.lineSeries[1].GetComponent <WMG_Series>().pointValues = pointPosSZ;
        lineGraph.lineSeries[0].GetComponent <WMG_Series>().seriesName  = "广州";
        lineGraph.lineSeries[1].GetComponent <WMG_Series>().seriesName  = "深圳";
        lineGraph.xAxis.LabelType = WMG_Axis.labelTypes.ticks;
        lineGraph.axisWidth       = 2;
        lineGraph.xAxis.hideGrid  = true;
        lineGraph.yAxis.hideGrid  = true;

        //lineGraph.graphType = WMG_Axis_Graph.graphTypes.bar_stacked;
        //lineGraph.orientationType = WMG_Axis_Graph.orientationTypes.horizontal;
        //lineGraph.resizeEnabled = true;
        //lineGraph.resizeProperties = WMG_Axis_Graph.ResizeProperties.AxesLabelOffset;
        //lineGraph.useGroups = true;
        //lineGraph.graphType = WMG_Axis_Graph.graphTypes.bar_side;
        //lineGraph.autoUpdateBarWidth = false;
        //lineGraph.autoUpdateBarAxisValue = false;
        //lineGraph.barWidth = 1f;
        //lineGraph.barAxisValue = 15f;
        //lineGraph.autoUpdateBarWidthSpacing = 0.1f;
        //lineGraph.resizeProperties = WMG_Axis_Graph.ResizeProperties.AutofitPadding;
        //lineGraph.resizeProperties = WMG_Axis_Graph.ResizeProperties.AxesLinePadding;
        //lineGraph.paddingLeftRight = new Vector2(70f, 50f);
        //lineGraph.paddingTopBottom = new Vector2(50f, 70f);
        //lineGraph.autoFitLabels = true;
        //lineGraph.autoFitPadding = 1f;
        //lineGraph.yAxis.AxisMinValue = 2f;
        //lineGraph.yAxis.AxisMaxValue = 13f;
        //lineGraph.yAxis.AxisNumTicks = 10;
        //lineGraph.yAxis.MinAutoGrow = true;
        //lineGraph.yAxis.MaxAutoGrow = true;
        //lineGraph.yAxis.MinAutoShrink = true;
        //lineGraph.yAxis.MaxAutoShrink = true;
        //lineGraph.yAxis.AxisLinePadding = 100f;
        //lineGraph.yAxis.HideAxisArrowTopRight = true;
        //lineGraph.yAxis.hideGrid = true;
        //lineGraph.yAxis.hideTick = true;  //没卵用
        //lineGraph.yAxis.hideTicks = true;
        lineGraph.yAxis.AxisTitleString = "出口";
        //lineGraph.yAxis.AxisTitleOffset = new Vector2(30f, 30f);
        //lineGraph.yAxis.AxisTitleFontSize = 30;


        lineGraph.Refresh();
    }