예제 #1
0
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            base.OnPopulateMesh(vh);
            vh.Clear();
            if (mAxis == null || mParent == null)
            {
                return;
            }
            CanvasChartMesh mesh = new CanvasChartMesh(vh);

            AddToCanvasChartMesh(mesh);
        }
예제 #2
0
 private void AddToCanvasChartMesh(CanvasChartMesh mesh)
 {
     mesh.Orientation = mOrientation;
     if (mIsSubDivisions)
     {
         mAxis.AddSubdivisionToChartMesh(mScrollOffset, mParent, transform, mesh, mOrientation);
     }
     else
     {
         mAxis.AddMainDivisionToChartMesh(mScrollOffset, mParent, transform, mesh, mOrientation);
     }
 }
예제 #3
0
        public void SetAxis(double scrollOffset, AnyChart parent, AxisBase axis, ChartOrientation axisOrientation, bool isSubDivisions)
        {
            mScrollOffset   = scrollOffset;
            raycastTarget   = false;
            color           = Color.white;
            mAxis           = axis;
            mParent         = parent;
            mIsSubDivisions = isSubDivisions;
            mOrientation    = axisOrientation;

            if (mMesh == null)
            {
                mMesh             = new CanvasChartMesh(true);
                mMesh.RecycleText = true;
            }
            mMesh.Clear();

            if (isSubDivisions)
            {
                mAxis.AddMainDivisionToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation);
            }
            else
            {
                mAxis.AddSubdivisionToChartMesh(mScrollOffset, mParent, transform, mMesh, mOrientation);
            }

            mTexts = mMesh.CurrentTextObjects;
            if (mMesh.TextObjects != null)
            {
                foreach (BillboardText text in mMesh.TextObjects)
                {
                    ((IInternalUse)parent).InternalTextController.AddText(text);
                }
            }

            canvasRenderer.materialCount = 1;
            if (mDispose != null)
            {
                ChartCommon.SafeDestroy(mDispose);
            }

            float tiling = 1f;

            if (!isSubDivisions)
            {
                if (axis.SubDivisions.Material != null)
                {
                    mMaterial          = axis.SubDivisions.Material;
                    mDispose           = new Material(mMaterial);
                    mDispose.hideFlags = HideFlags.DontSave;
                    material           = mDispose;
                    tiling             = GetTiling(axis.SubDivisions.MaterialTiling);
                }
            }
            else
            {
                if (axis.MainDivisions.Material != null)
                {
                    mMaterial          = axis.MainDivisions.Material;
                    mDispose           = new Material(mMaterial);
                    mDispose.hideFlags = HideFlags.DontSave;
                    material           = mDispose;
                    tiling             = GetTiling(axis.MainDivisions.MaterialTiling);
                }
            }
            mTiling = tiling;
            if (mDispose != null)
            {
                if (mDispose.HasProperty("_ChartTiling"))
                {
                    mDispose.SetFloat("_ChartTiling", tiling);
                }
            }
            SetAllDirty();
            Rebuild(CanvasUpdate.PreRender);
            mMesh.DestoryRecycled();
        }