Exemple #1
0
        /// <summary>
        /// Get the value currently for the specified column and row
        /// </summary>
        /// <param name="ColumnName">the name of the column</param>
        /// <param name="rowIndex"> the index of the row</param>
        /// <returns></returns>
        public double GetValue(String ColumnName, int rowIndex)
        {
            ChartDataColumn column = mColumns[ColumnName];
            ChartDataRow    row    = mRows[rowIndex];

            return(InnerGetValue(column, row));
        }
        /// <summary>
        /// removes a category from the radar chart
        /// </summary>
        /// <param name="name">the name of the category to remove</param>
        public void RemoveCategory(string name)
        {
            ChartDataColumn column = mDataSource.Columns[name];

            RemoveSliderForCategory(name);
            mDataSource.Columns.Remove(column);
        }
Exemple #3
0
 /// <summary>
 /// Raw data is prepared and held as long as the structed or order of the table has not changed
 /// </summary>
 private void PrepareRawData()
 {
     mChartDataToIndex.Clear();
     for (int i = 0; i < mColumns.Count; i++)
     {
         ChartDataColumn column = mColumns[i];
         mChartDataToIndex.Add(column, i);
     }
     for (int i = 0; i < mRows.Count; i++)
     {
         ChartDataRow row = mRows[i];
         mChartDataToIndex.Add(row, i);
     }
     mRawData = new double[mRows.Count, mColumns.Count];
     foreach (KeyValuePair <KeyElement, double> pair in mData)
     {
         int columnIndex;
         int rowIndex;
         if (mChartDataToIndex.TryGetValue(pair.Key.Column, out columnIndex) == false)
         {
             continue;
         }
         if (mChartDataToIndex.TryGetValue(pair.Key.Row, out rowIndex) == false)
         {
             continue;
         }
         mRawData[rowIndex, columnIndex] = pair.Value;
     }
     FindMinMaxValue();
 }
Exemple #4
0
        /// <summary>
        /// Get the value currently for the specified column and row
        /// </summary>
        /// <param name="columnIndex">the index of the column</param>
        /// <param name="rowIndex"> the index of the row</param>
        /// <returns></returns>
        public double GetValue(int columnIndex, int rowIndex)
        {
            ChartDataColumn column = mColumns[columnIndex];
            ChartDataRow    row    = mRows[rowIndex];

            return(InnerGetValue(column, row));
        }
Exemple #5
0
        /// <summary>
        /// Adds a new category to the bar chart. Each category has it's own material and name.
        /// Note: you must also add groups to the bar data.
        /// Example: you can set the chart categories to be "Player 1","Player 2","Player 3" in order to compare player achivments
        /// </summary>
        /// <param name="name">the name of the category</param>
        /// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
        public void AddCategory(string name, ChartDynamicMaterial material, int position)
        {
            ChartDataColumn column = new ChartDataColumn(name);

            column.Material = material;
            mDataSource.mColumns.Insert(position, column);
        }
Exemple #6
0
        /// <summary>
        /// Sets the value for the specified column and row.
        /// </summary>
        /// <param name="columnIndex">the index of the column</param>
        /// <param name="rowIndex">the index of the row</param>
        /// <param name="amount"> the new value</param>
        public void SetValue(int columnIndex, int rowIndex, double amount)
        {
            ChartDataColumn column = mColumns[columnIndex];
            ChartDataRow    row    = mRows[rowIndex];

            InnerSetValue(column, row, amount);
        }
        private void AddCategory(string name, CategoryData data)
        {
            ChartDataColumn column = new ChartDataColumn(name);

            column.UserData = data;
            mDataSource.mColumns.Add(column);
        }
Exemple #8
0
        /// <summary>
        /// Adds a new category to the pyramid chart. Each category has it's own material and name. each category corresponds to one pie slice
        /// </summary>
        /// <param name="name">the name of the category</param>
        /// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
        public void AddCategory(string name, ChartDynamicMaterial material, String title, String text, Sprite image, float alpha = 1f, float heightRatio = 1f, float leftSlope = 45f, float rightSlope = 45f, float positionBlend = 1f, float scale = 1f, float shiftX = 0f, float shiftY = 0f)
        {
            if (title == null)
            {
                title = "";
            }
            if (text == null)
            {
                text = "";
            }

            ChartDataColumn column = new ChartDataColumn(name);

            column.Material = material;
            CategoryData d = new CategoryData();

            d.Title         = title;
            d.Text          = text;
            d.Image         = image;
            d.Alpha         = alpha;
            d.HeightRatio   = heightRatio;
            d.LeftSlope     = leftSlope;
            d.RightSlope    = rightSlope;
            d.PositionBlend = positionBlend;
            d.Scale         = scale;
            d.ShiftX        = shiftX;
            d.ShiftY        = shiftY;
            column.UserData = d;
            mDataSource.mColumns.Add(column);
            SetValueInternal(name, "Pyramid", heightRatio);
        }
Exemple #9
0
        /// <summary>
        /// Sets the value for the specified column and row
        /// </summary>
        /// <param name="ColumnName">the name of the column</param>
        /// <param name="RowName"> the name of the row</param>
        /// <param name="amount"> the new value</param>
        public void SetValue(string ColumnName, string RowName, double amount)
        {
            ChartDataColumn column = mColumns[ColumnName];
            ChartDataRow    row    = mRows[RowName];

            InnerSetValue(column, row, amount);
        }
Exemple #10
0
        /// <summary>
        /// Sets the value for the specified column and row.
        /// </summary>
        /// <param name="ColumnName">the name of the column</param>
        /// <param name="rowIndex">the index of the row</param>
        /// <param name="amount"> the new value</param>
        public void SetValue(String ColumnName, int rowIndex, double amount)
        {
            ChartDataColumn column = mColumns[ColumnName];
            ChartDataRow    row    = mRows[rowIndex];

            InnerSetValue(column, row, amount);
        }
Exemple #11
0
        /// <summary>
        /// Adds a new category to the bar chart. Each category has it's own material and name.
        /// Note: you must also add groups to the bar data.
        /// Example: you can set the chart categories to be "Player 1","Player 2","Player 3" in order to compare player achivments
        /// </summary>
        /// <param name="name">the name of the category</param>
        /// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
        public void AddCategory(string name, ChartDynamicMaterial material)
        {
            ChartDataColumn column = new ChartDataColumn(name);

            column.Material = material;
            mDataSource.mColumns.Add(column);
        }
Exemple #12
0
        /// <summary>
        /// Get the value currently for the specified column and row
        /// </summary>
        /// <param name="ColumnName">the name of the column</param>
        /// <param name="RowName"> the name of the row</param>
        /// <returns></returns>
        public double GetValue(String ColumnName, String RowName)
        {
            ChartDataColumn column = mColumns[ColumnName];
            ChartDataRow    row    = mRows[RowName];

            return(InnerGetValue(column, row));
        }
Exemple #13
0
        private void InnerSetValue(ChartDataColumn column, ChartDataRow row, double amount)
        {
            EnsureRawData();
            int columnIndex, rowIndex;

            if (mChartDataToIndex.TryGetValue(column, out columnIndex) == false)
            {
                throw new ChartException("value cannot be set"); // should never happen
            }
            if (mChartDataToIndex.TryGetValue(row, out rowIndex) == false)
            {
                throw new ChartException("value cannot be set"); // should never happen
            }
            mRawData[rowIndex, columnIndex] = amount;

            KeyElement elem = new KeyElement(row, column);
            double     oldValue;

            if (mData.TryGetValue(elem, out oldValue) == false)
            {
                oldValue = 0.0;
            }
            mData[elem] = amount;
            bool minMaxChanged = VerifyMinMaxValue(elem, amount);

            if (mSuspendEvents == false)
            {
                OnDataValueChanged(new DataValueChangedEventArgs(rowIndex, columnIndex, 0.0, amount, minMaxChanged));
            }
            else
            {
                mFireEvent = true;
            }
        }
Exemple #14
0
        private double InnerGetValue(ChartDataColumn column, ChartDataRow row)
        {
            KeyElement elem = new KeyElement(row, column);
            double     res;

            if (mData.TryGetValue(elem, out res) == false)
            {
                return(0.0);
            }
            return(res);
        }
        /// <summary>
        /// Adds a new category to the pie chart. Each category has it's own material and name. each category corresponds to one pie slice
        /// </summary>
        /// <param name="name">the name of the category</param>
        /// <param name="material">the dynamic material of the category. dynamic materials allows setting the material for different events</param>
        public void AddCategory(string name, ChartDynamicMaterial material, float radiusScale, float depthScale, float depthOffset)
        {
            radiusScale = Mathf.Clamp(radiusScale, 0f, 1f);
            ChartDataColumn column = new ChartDataColumn(name);

            column.Material = material;
            CategoryData d = new CategoryData();

            d.RadiusScale   = radiusScale;
            d.DepthScale    = depthScale;
            d.DepthOffset   = depthOffset;
            column.UserData = d;
            mDataSource.mColumns.Add(column);
        }
Exemple #16
0
        public void SetCategoryIndex(string name, int index)
        {
            ChartDataColumn col = mDataSource.mColumns[name];

            double[] values = new double[TotalGroups];
            for (int i = 0; i < TotalGroups; i++)
            {
                string g = GetGroupName(i);
                values[i] = GetValue(name, g);
            }

            mDataSource.Columns.Remove(col);
            mDataSource.Columns.Insert(index, col);
            for (int i = 0; i < TotalGroups; i++)
            {
                string g = GetGroupName(i);
                SetValue(name, g, values[i]);
            }
        }
        /// <summary>
        /// Adds a new category to the radar chart. Each category has it's own materials and name.
        /// Note: you must also add groups to the radar data.
        /// Example: you can set the chart categories to be "Player 1","Player 2","Player 3" in order to compare player achivments
        /// </summary>
        protected void AddInnerCategory(string name, PathGenerator linePrefab, Material lineMaterial, float lineThickness, GameObject pointPrefab, Material pointMaterial, float pointSize, Material fillMaterial, int fillSmoothing, float curve, float seperation)
        {
            ChartDataColumn column = new ChartDataColumn(name);
            CategoryData    data   = new CategoryData();

            data.LinePrefab    = linePrefab;
            data.LineMaterial  = lineMaterial;
            data.LineThickness = lineThickness;
            data.PointMaterial = pointMaterial;
            data.PointSize     = pointSize;
            data.PointPrefab   = pointPrefab;
            data.FillMaterial  = fillMaterial;
            if (fillSmoothing < 1)
            {
                fillSmoothing = 1;
            }
            data.FillSmoothing = fillSmoothing;
            data.Curve         = curve;
            data.Seperation    = seperation;
            data.Name          = name;
            column.UserData    = data;
            mDataSource.mColumns.Add(column);
        }
Exemple #18
0
 public KeyElement(ChartDataRow row, ChartDataColumn column) : this()
 {
     Row    = row;
     Column = column;
 }
Exemple #19
0
 public bool IsInColumn(ChartDataColumn column)
 {
     return(column == Column);
 }
Exemple #20
0
 void Columns_ItemRemoved(ChartDataColumn obj)
 {
     ItemRemoved(obj);
 }