public void OnBeforeSerialize()
        {
            int totalColumns = mDataSource.Columns.Count;

            mCategories = new CategoryData[totalColumns];
            for (int i = 0; i < totalColumns; i++)
            {
                CategoryData data = new CategoryData();
                data.Name      = mDataSource.Columns[i].Name;
                data.Materials = mDataSource.Columns[i].Material;
                object userData = mDataSource.Columns[i].UserData;
                if (userData != null && userData is CategoryData)
                {
                    data.RadiusScale = ((CategoryData)userData).RadiusScale;
                    data.DepthScale  = ((CategoryData)userData).DepthScale;
                    data.DepthOffset = ((CategoryData)userData).DepthOffset;
                }
                else
                {
                    data.RadiusScale = 1f;
                    data.DepthScale  = 1f;
                    data.DepthOffset = 1f;
                }
                mCategories[i] = data;
            }

            int totalRows = mDataSource.Rows.Count;

            mGroups = new string[totalRows];
            for (int i = 0; i < totalRows; i++)
            {
                mGroups[i] = mDataSource.Rows[i].Name;
            }

            double[,] raw = mDataSource.getRawData();
            int current = 0;

            mData = new DataEntry[raw.GetLength(0) * raw.GetLength(1)];
            for (int i = 0; i < raw.GetLength(0); ++i)
            {
                for (int j = 0; j < raw.GetLength(1); ++j)
                {
                    DataEntry entry = new DataEntry();
                    entry.ColumnName = mDataSource.Columns[j].Name;
                    entry.GroupName  = mDataSource.Rows[i].Name;
                    entry.Amount     = raw[i, j];
                    mData[current++] = entry;
                }
            }
        }
        public void OnBeforeSerialize()
        {
            int totalColumns = mDataSource.Columns.Count;

            mCategories = new CategoryData[totalColumns];
            for (int i = 0; i < totalColumns; i++)
            {
                CategoryData data = mDataSource.Columns[i].UserData as CategoryData;
                if (data.FillSmoothing < 1)
                {
                    data.FillSmoothing = 1;
                }
                data.Name      = mDataSource.Columns[i].Name;
                mCategories[i] = data;
            }

            int totalRows = mDataSource.Rows.Count;

            mGroups = new string[totalRows];
            for (int i = 0; i < totalRows; i++)
            {
                mGroups[i] = mDataSource.Rows[i].Name;
            }

            double[,] raw = mDataSource.getRawData();
            int current = 0;

            mData = new DataEntry[raw.GetLength(0) * raw.GetLength(1)];
            for (int i = 0; i < raw.GetLength(0); ++i)
            {
                for (int j = 0; j < raw.GetLength(1); ++j)
                {
                    DataEntry entry = new DataEntry();
                    entry.ColumnName = mDataSource.Columns[j].Name;
                    entry.GroupName  = mDataSource.Rows[i].Name;
                    entry.Amount     = raw[i, j];
                    mData[current++] = entry;
                }
            }
        }
예제 #3
0
        public void OnBeforeSerialize()
        {
            int totalColumns = mDataSource.Columns.Count;

            mCategories = new CategoryData[totalColumns];
            for (int i = 0; i < totalColumns; i++)
            {
                CategoryData data = new CategoryData();
                data.Name      = mDataSource.Columns[i].Name;
                data.Materials = mDataSource.Columns[i].Material;
                object userData = mDataSource.Columns[i].UserData;
                if (userData != null && userData is CategoryData)
                {
                    data.Alpha         = ((CategoryData)userData).Alpha;
                    data.HeightRatio   = ((CategoryData)userData).HeightRatio;
                    data.Image         = ((CategoryData)userData).Image;
                    data.Title         = ((CategoryData)userData).Title;
                    data.LeftSlope     = ((CategoryData)userData).LeftSlope;
                    data.RightSlope    = ((CategoryData)userData).RightSlope;
                    data.Scale         = ((CategoryData)userData).Scale;
                    data.ShiftX        = ((CategoryData)userData).ShiftX;
                    data.ShiftY        = ((CategoryData)userData).ShiftY;
                    data.Text          = ((CategoryData)userData).Text;
                    data.PositionBlend = ((CategoryData)userData).PositionBlend;
                }
                else
                {
                    data.Alpha         = 1f;
                    data.HeightRatio   = 1f;
                    data.Image         = null;
                    data.Title         = "";
                    data.LeftSlope     = -0.5f;
                    data.RightSlope    = -0.5f;
                    data.Scale         = 1f;
                    data.ShiftX        = 0f;
                    data.ShiftY        = 0f;
                    data.Text          = ((CategoryData)userData).Text;
                    data.PositionBlend = 1f;
                }
                mCategories[i] = data;
            }

            int totalRows = mDataSource.Rows.Count;

            mGroups = new string[totalRows];
            for (int i = 0; i < totalRows; i++)
            {
                mGroups[i] = mDataSource.Rows[i].Name;
            }

            double[,] raw = mDataSource.getRawData();
            int current = 0;

            mData = new DataEntry[raw.GetLength(0) * raw.GetLength(1)];
            for (int i = 0; i < raw.GetLength(0); ++i)
            {
                for (int j = 0; j < raw.GetLength(1); ++j)
                {
                    DataEntry entry = new DataEntry();
                    entry.ColumnName = mDataSource.Columns[j].Name;
                    entry.GroupName  = mDataSource.Rows[i].Name;
                    entry.Amount     = raw[i, j];
                    mData[current++] = entry;
                }
            }
        }