Example #1
0
        public static PlainCommonGraph create_plain_graph(PlainGraphType type)
        {
            PlainCommonGraph graph;

            switch (type)
            {
            case PlainGraphType.Line:
                graph = new LineGraph();
                break;

            case PlainGraphType.LinePoint:
                graph = new LinePointGraph();
                break;

            default:
            case PlainGraphType.LineArea:
                graph = new LineAreaGraph();
                break;

            case PlainGraphType.Column:
                graph = new ColumnGraph();
                break;

            case PlainGraphType.StackedColumn:
                graph = new StackedColumnGraph();
                break;

            case PlainGraphType.StackedPercentColumn:
                graph = new StackedPercentColumnGraph();
                break;

            case PlainGraphType.Pie:
                graph = new PieGraph();
                break;
                //case PlainGraphType.Pie3D:
                //  graph = new Pie3DGraph();           // not support yet
                //  break;
                //case PlainGraphType.ExplodedPie:
                //  graph = new ExplodedPieGraph();     // not support yet
                //  break;
            }

            return(graph);
        }
    public override void Graficar <T>(Dictionary <T, int> datos, bool setSize = true)
    {
        base.Graficar(datos);

        if (debug)
        {
            for (int i = 0; i < valores.Length; i++)
            {
                GameObject cGO = Instantiate(columnaPrefab, columnsTransform, false);
                cGO.SetActive(true);

                ColumnGraph column = cGO.GetComponent <ColumnGraph>();
                column.SetHeight(MapYValue(valores[i]));
                column.SetValue(valores[i]);

                columnPrefabs.Add(cGO);
            }
        }
        else
        {
            info = SetInfoStruct(datos);

            foreach (var dato in datos)
            {
                GameObject cGO = Instantiate(columnaPrefab, columnsTransform, false);
                cGO.SetActive(true);

                ColumnGraph column = cGO.GetComponent <ColumnGraph>();

                column.SetHeight(MapYValue(dato.Value));
                column.SetValue(dato.Value);

                columnPrefabs.Add(cGO);
            }
        }
    }