Exemple #1
0
    // Use this for initialization
    void Start()
    {
        CSVDataSource csvds = createCSVDataSource(dataSource.text);

        Gradient g = new Gradient();

        GradientColorKey[] gck = new GradientColorKey[2];
        gck[0]      = new GradientColorKey(Color.blue, 0);
        gck[1]      = new GradientColorKey(Color.red, 1);
        g.colorKeys = gck;

        //stock,date,open

        // create a view builder with the point topology
        ViewBuilder vb = new ViewBuilder(MeshTopology.Lines, "Uber pick up point visualisation").
                         initialiseDataView(csvds.DataCount).
                         setDataDimension(csvds["stock"].Data, ViewBuilder.VIEW_DIMENSION.X).
                         setDataDimension(csvds["date"].Data, ViewBuilder.VIEW_DIMENSION.Y).
                         setDataDimension(csvds["open"].Data, ViewBuilder.VIEW_DIMENSION.Z).
                         setSize(csvds["volume"].Data).
                         setColors(csvds["volume"].Data.Select(x => g.Evaluate(x)).ToArray()).
                         createIndicesLinkedTopology(csvds["stock"].Data);

        // create a view builder with the point topology

        Material mt = IATKUtil.GetMaterialFromTopology(AbstractVisualisation.GeometryType.Lines);

        //Material mt = new Material(Shader.Find("IATK/LinesShader"));
        mt.mainTexture = Resources.Load("circle-outline-basic") as Texture2D;
        mt.renderQueue = 3000;
        mt.SetFloat("_MinSize", 0.01f);
        mt.SetFloat("_MaxSize", 0.05f);

        View view = vb.updateView().apply(gameObject, mt);
    }
Exemple #2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="csvds">CSV data source</param>
    /// <param name="filteringValue"> filtered value</param>
    /// <param name="filteringAttribute"> filtering attribute </param>
    /// <param name="color"></param>
    /// <returns></returns>
    View Facet(CSVDataSource csvds, string filteringValue, string filteringAttribute, Color color)
    {
        //B02598
        //B02512

        // filters the array on a particular value in another dimension
        Filter baseFilter = (array, datasource, value, dimension) =>
        {
            return(array.Select((b, i) => new { index = i, _base = b })
                   .Where(b => datasource.getOriginalValuePrecise(csvds[dimension].Data[b.index], dimension).ToString() == value)
                   .Select(b => b._base).ToArray());
        };

        Filter identity = (ar, ds, fv, fa) => { return(ar); };
        // baseFilter = identity;

        var xData = baseFilter(csvds["Lat"].Data, csvds, filteringValue, filteringAttribute);
        var yData = baseFilter(csvds["Lon"].Data, csvds, filteringValue, filteringAttribute);
        var zData = baseFilter(csvds["Base"].Data, csvds, filteringValue, filteringAttribute);

        ViewBuilder vb = new ViewBuilder(MeshTopology.Points, "Uber pick up point visualisation").
                         initialiseDataView(xData.Length).
                         setDataDimension(xData, ViewBuilder.VIEW_DIMENSION.X).
                         setDataDimension(yData, ViewBuilder.VIEW_DIMENSION.Y).
                         //setDataDimension(zData, ViewBuilder.VIEW_DIMENSION.Z).
                         setSize(baseFilter(csvds["Date"].Data, csvds, filteringValue, filteringAttribute)).
                         setColors(xData.Select(x => color).ToArray());

        Material mt = IATKUtil.GetMaterialFromTopology(AbstractVisualisation.GeometryType.Points);

        mt.SetFloat("_MinSize", 0.01f);
        mt.SetFloat("_MaxSize", 0.05f);

        return(vb.updateView().apply(gameObject, mt));
    }
Exemple #3
0
    // a space time cube
    View Uber(CSVDataSource csvds)
    {
        // header
        // Date,Time,Lat,Lon,Base
        Gradient g = new Gradient();

        GradientColorKey[] gck = new GradientColorKey[2];
        gck[0]      = new GradientColorKey(Color.blue, 0);
        gck[1]      = new GradientColorKey(Color.red, 1);
        g.colorKeys = gck;

        // create a view builder with the point topology
        ViewBuilder vb = new ViewBuilder(MeshTopology.Points, "Uber pick up point visualisation").
                         initialiseDataView(csvds.DataCount).
                         setDataDimension(csvds["Lat"].Data, ViewBuilder.VIEW_DIMENSION.X).
                         setDataDimension(csvds["Base"].Data, ViewBuilder.VIEW_DIMENSION.Y).
                         setSize(csvds["Base"].Data).
                         setColors(csvds["Time"].Data.Select(x => g.Evaluate(x)).ToArray());

        // initialise the view builder wiith thhe number of data points and parent GameOBject

        //Enumerable.Repeat(1f, dataSource[0].Data.Length).ToArray()
        Material mt = IATKUtil.GetMaterialFromTopology(AbstractVisualisation.GeometryType.Points);

        mt.SetFloat("_MinSize", 0.01f);
        mt.SetFloat("_MaxSize", 0.05f);

        View v = vb.updateView().apply(gameObject, mt);

        return(v);
    }
Exemple #4
0
    // a space time cube
    View CreateBarchart(CSVDataSource csvds, GameObject go, int count)
    {
        // header
        // Date,Time,Lat,Lon,Base
        Gradient g = new Gradient();

        GradientColorKey[] gck = new GradientColorKey[2];
        gck[0]      = new GradientColorKey(Color.blue, 0);
        gck[1]      = new GradientColorKey(Color.red, 1);
        g.colorKeys = gck;

        // create a view builder with the point topology
        ViewBuilder vb = new ViewBuilder(MeshTopology.Points, "BarCharts-" + count).
                         initialiseDataView(csvds.DataCount).
                         setDataDimension(csvds["Country"].Data, ViewBuilder.VIEW_DIMENSION.X).
                         setDataDimension(csvds["Value"].Data, ViewBuilder.VIEW_DIMENSION.Y).
                         setDataDimension(csvds["Year"].Data, ViewBuilder.VIEW_DIMENSION.Z);
        //setSize(csvds["Maximum"].Data).
        //        setSingleColor(Color.white);
        //setColors(csvds["Time"].Data.Select(x => g.Evaluate(x)).ToArray());

        // initialise the view builder wiith thhe number of data points and parent GameOBject

        //Enumerable.Repeat(1f, dataSource[0].Data.Length).ToArray()
        Material mt = IATKUtil.GetMaterialFromTopology(AbstractVisualisation.GeometryType.Bars);

        mt.SetFloat("_MinSize", 0.01f);
        mt.SetFloat("_MaxSize", 0.05f);

        View          v             = vb.updateView().apply(go, mt);
        Visualisation visualisation = new Visualisation();

        visualisation.dataSource = csvds;

        //  Visualisation

        Vector3 posx = Vector3.zero;

        posx.y = -0.05f;

        DimensionFilter xDimension = new DimensionFilter {
            Attribute = "Country"
        };
        //xDimension.minFilter;
        GameObject X_AXIS = CreateAxis(AbstractVisualisation.PropertyType.X, xDimension, posx, new Vector3(0f, 0f, 0f), 0, csvds, visualisation, go);
        Vector3    posy   = Vector3.zero;

        posy.x = -0.05f;

        DimensionFilter yDimension = new DimensionFilter {
            Attribute = "Value"
        };
        GameObject Y_AXIS = CreateAxis(AbstractVisualisation.PropertyType.Y, yDimension, posy, new Vector3(0f, 0f, 0f), 1, csvds, visualisation, go);
        Vector3    posz   = Vector3.zero;

        posz.y = -0.05f;
        posz.x = -0.05f;
        DimensionFilter zDimension = new DimensionFilter {
            Attribute = "Year"
        };
        GameObject Z_AXIS = CreateAxis(AbstractVisualisation.PropertyType.Z, zDimension, posz, new Vector3(90f, 0f, 0f), 2, csvds, visualisation, go);

        return(v);
    }