Ejemplo n.º 1
0
        internal void LoadSeriesColorSet(DataSeries dataSeries)
        {
            ColorSet colorSet4MultiSeries = null;
            Boolean FLAG_UNIQUE_COLOR_4_EACH_DP = false; // Unique color for each DataPoint
            Brush seriesColor = null;
          

            if (dataSeries.RenderAs == RenderAs.CandleStick)
            {
                if (dataSeries.PriceUpColor == null)
                {
                    dataSeries.IsNotificationEnable = false;
                    dataSeries.PriceUpColor = _financialColorSet.GetNewColorFromColorSet();
                    dataSeries.IsNotificationEnable = true;
                }
            }
            else
            {
                colorSet4MultiSeries = _chartColorSet;
                FLAG_UNIQUE_COLOR_4_EACH_DP = false;

                if (!String.IsNullOrEmpty(dataSeries.ColorSet))
                {
                    colorSet4MultiSeries = Chart.GetColorSetByName(dataSeries.ColorSet);

                    if (colorSet4MultiSeries == null)
                        throw new Exception("ColorSet named " + dataSeries.ColorSet + " is not found.");

                    FLAG_UNIQUE_COLOR_4_EACH_DP = true;
                }
                else if (colorSet4MultiSeries == null)
                {
                    throw new Exception("ColorSet named " + Chart.ColorSet + " is not found.");
                }

                if (dataSeries.RenderAs == RenderAs.Area || dataSeries.RenderAs == RenderAs.StackedArea || dataSeries.RenderAs == RenderAs.StackedArea100)
                {
                    seriesColor = colorSet4MultiSeries.GetNewColorFromColorSet();

                    Brush DataSeriesColor = dataSeries.GetValue(DataSeries.ColorProperty) as Brush;

                    if (DataSeriesColor == null)
                    {
                        dataSeries._internalColor = seriesColor;
                    }
                    else
                        dataSeries._internalColor = DataSeriesColor;

                    foreach (DataPoint dp in dataSeries.DataPoints)
                    {   
                        dp.IsNotificationEnable = false;

                        Brush dPColor = dp.GetValue(DataPoint.ColorProperty) as Brush;

                        if (dPColor != null)
                            dp._internalColor = dPColor;

                        dp.IsNotificationEnable = true;
                    }
                }

                else
                {
                    if (!FLAG_UNIQUE_COLOR_4_EACH_DP || dataSeries.RenderAs == RenderAs.Line)
                        seriesColor = colorSet4MultiSeries.GetNewColorFromColorSet();

                    foreach (DataPoint dp in dataSeries.DataPoints)
                    {   
                        dp.IsNotificationEnable = false;
                        Brush dPColor = dp.GetValue(DataPoint.ColorProperty) as Brush;
                        
                        Brush DataSeriesColor = dataSeries.GetValue(DataSeries.ColorProperty) as Brush;

                        if (dPColor == null)
                        {   
                            // If unique color for each DataPoint
                            if (FLAG_UNIQUE_COLOR_4_EACH_DP)
                            {
                                if (DataSeriesColor == null)
                                {
                                    dp._internalColor = colorSet4MultiSeries.GetNewColorFromColorSet();

                                    if (dataSeries.RenderAs == RenderAs.Line)
                                        dataSeries._internalColor = seriesColor;
                                    else
                                        dataSeries._internalColor = null;
                                }
                                else
                                    dataSeries._internalColor = DataSeriesColor;

                            }
                            else
                            {   
                                if (DataSeriesColor == null)
                                    dataSeries._internalColor = seriesColor;
                                else
                                    dataSeries._internalColor = DataSeriesColor;

                                dp.IsNotificationEnable = true;

                                break;
                            }
                        }
                        else
                            dp._internalColor = dPColor;

                        dp.IsNotificationEnable = true;
                    }
                }

                dataSeries.IsNotificationEnable = true;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Get Opacity for Radar
 /// </summary>
 /// <param name="series"></param>
 /// <returns></returns>
 private static Double GetOpacity4Radar(DataSeries series)
 {
     if (series.GetValue(DataSeries.OpacityProperty) == null)
         return 0.65;
     else
         return (Double)series.Opacity;
 }
Ejemplo n.º 3
0
        internal void LoadSeriesColorSet4SingleSeries(DataSeries dataSeries)
        {
            ColorSet colorSet = _chartColorSet;

            if (dataSeries.RenderAs == RenderAs.CandleStick)
            {
                if (dataSeries.PriceUpColor == null)
                {
                    dataSeries.IsNotificationEnable = false;
                    dataSeries.PriceUpColor = _financialColorSet.GetNewColorFromColorSet();
                    dataSeries.IsNotificationEnable = true;
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(dataSeries.ColorSet))
                {
                    colorSet = Chart.GetColorSetByName(dataSeries.ColorSet);

                    if (colorSet == null)
                        throw new Exception("ColorSet named " + dataSeries.ColorSet + " is not found.");
                }
                else if (colorSet == null)
                {
                    throw new Exception("ColorSet named " + Chart.ColorSet + " is not found.");
                }

                Brush seriesColor = dataSeries.GetValue(DataSeries.ColorProperty) as Brush;

                if (!Chart.UniqueColors || dataSeries.RenderAs == RenderAs.Area || dataSeries.RenderAs == RenderAs.Line || dataSeries.RenderAs == RenderAs.StackedArea || dataSeries.RenderAs == RenderAs.StackedArea100)
                {
                    if (seriesColor == null)
                        dataSeries._internalColor = colorSet.GetNewColorFromColorSet();
                    else
                        dataSeries._internalColor = seriesColor;

                    colorSet.ResetIndex();

                    foreach (DataPoint dp in dataSeries.DataPoints)
                    {
                        dp.IsNotificationEnable = false;

                        Brush dPColor = dp.GetValue(DataPoint.ColorProperty) as Brush;

                        if (dPColor == null)
                            if (!Chart.UniqueColors)
                                dp._internalColor = dataSeries._internalColor;
                            else if (seriesColor == null)
                                dp._internalColor = colorSet.GetNewColorFromColorSet();
                            else
                                dp._internalColor = seriesColor;
                        else
                            dp._internalColor = dPColor;

                        dp.IsNotificationEnable = true;
                    }
                }
                else
                {
                    dataSeries._internalColor = null;

                    foreach (DataPoint dp in dataSeries.DataPoints)
                    {
                        dp.IsNotificationEnable = false;

                        Brush dPColor = dp.GetValue(DataPoint.ColorProperty) as Brush;

                        if (dPColor == null)
                        {
                            if (seriesColor == null)
                                dp._internalColor = colorSet.GetNewColorFromColorSet();
                            else
                                dp._internalColor = seriesColor;
                        }
                        else
                            dp._internalColor = dPColor;

                        dp.IsNotificationEnable = true;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void SetColor4CircularSeries(DataSeries dataSeries, ColorSet colorSet4MultiSeries, Boolean isUniqueColor4EachDP)
        {
            if (dataSeries.Color == null)
            {
                Brush colorFromColorSet = colorSet4MultiSeries.GetNewColorFromColorSet();

                Brush seriesColor = dataSeries.GetValue(DataSeries.ColorProperty) as Brush;

                if (seriesColor == null)
                    dataSeries._internalColor = colorFromColorSet;
                else
                    dataSeries._internalColor = seriesColor;

                foreach (DataPoint dp in dataSeries.DataPoints)
                {
                    dp.IsNotificationEnable = false;

                    Brush dPColor = dp.GetValue(DataPoint.ColorProperty) as Brush;

                    if (dPColor == null)
                    {
                        // If unique color for each DataPoint
                        if (isUniqueColor4EachDP)
                        {
                            if (seriesColor == null)
                                dp._internalColor = colorSet4MultiSeries.GetNewColorFromColorSet();
                            else
                                dp._internalColor = seriesColor;
                        }
                        else
                        {
                            if (seriesColor == null)
                                dataSeries._internalColor = colorFromColorSet;
                            else
                                dataSeries._internalColor = seriesColor;

                            dp.IsNotificationEnable = true;

                            break;
                        }
                    }
                    else
                        dp._internalColor = dPColor;


                    dp.IsNotificationEnable = true;
                }
            }
        }