We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Unable to Change colors of points for Stock Chart + C#

Tried all properties: applied Solidfill.Color on LINE format but still coming default blue color.

Even Tried using Points but no avail.

Please help.

@pkmark2,

I have observed the issue shared by you and request you to please share the source presentation, working sample code and desired output presentation. We will investigate the issue further on our end on provision of requested information.

Here is the code. plus chart image

The issue is chart points color is coming blue by default.

stock.png (4.3 KB)

private void BindStockChart(ChartEx chart, ChartData chartData, RC.Data.POCO.Widget widget, string colorScheme)
{
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
chart.ChartData.ChartDataWorkbook.Clear(0);

        int row = 0;
        int col = 0;
        int i = 0;

        //Round Off Data
        int roundTo = chartData.TableProperties.decimalplace;

        if (widget.Properties.DataLabels.Style.FontSize != 0)
            FontSize = widget.Properties.DataLabels.Style.FontSize;

        ChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;

        Dictionary<string, List<double>> chartData1 = new Dictionary<string, List<double>>();

        chartData1.Add("High", chartData.High);
        chartData1.Add("Low", chartData.Low);
        chartData1.Add("Close", chartData.Close);
        chartData1.Add("Open", chartData.Close);

        List<Color> colors = GetRandColor(chartData.Series.Count, colorScheme);

        foreach (string category in chartData.Category)
        {
            i++;
            chart.ChartData.Categories.Add(fact.GetCell(0, i, 0, category));
        }

        string[] keys = new string[4] { "High", "Low", "Close", "Open" };

        for (int j = 0; j < keys.Length; j++)
        {
            row = 0;
            col = j + 1;
            chart.ChartData.Series.Add(fact.GetCell(0, row, col, keys[j]), chart.Type);


            ChartSeriesEx series = chart.ChartData.Series[j];
            series.InvertIfNegative = false;

            Color color = widget.Properties.Series.ContainsKey(series.NameCells.GetConcateNameFromCells) && !string.IsNullOrEmpty(widget.Properties.Series[series.NameCells.GetConcateNameFromCells].Style.Color) ? ColorTranslator.FromHtml(widget.Properties.Series[series.NameCells.GetConcateNameFromCells].Style.Color) : colors.ElementAt(0);

            foreach (double val in chartData1[keys[j]])
            {
                row++;
                if (val != -1.0 || val != -1)
                    series.Values.Add(fact.GetCell(0, row, col, Math.Round(val, roundTo)));
                else
                    series.Values.Add(fact.GetCell(0, row, col));

            }

            series.MarkerSize = 7;

            series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;
            switch (keys[j].ToLower())
            {
                case "low":
                    series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Red;
                    break;
                case "high":
                    series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Green;
                    break;
                case "close":
                case "open":
                    series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Orange;
                    break;
            }

            SetProperties(series, chart, chartData, widget);
            series.MarkerSymbol = MarkerStyleTypeEx.Circle;
            series.MarkerFill.Fill.FillType = FillTypeEx.Solid;
            series.MarkerFill.Fill.SolidFillColor.Color = color;
            series.Format.Fill.FillType = FillTypeEx.Solid;
            series.Format.Fill.SolidFillColor.Color = color;
            series.Format.Line.FillFormat.FillType = FillTypeEx.Solid;
            series.Format.Line.FillFormat.SolidFillColor.Color = color;

            series.Labels.ShowValue = true;
            if (!(bool)widget.Properties.XAxis.Visible.Grid_Lines)
            {
                chart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.NoFill;
            }

            if (widget.Properties.XAxis.Visible.Title == true)
            {
                chart.CategoryAxis.HasTitle = widget.Properties.XAxis.Visible.Title;
                if (chart.CategoryAxis.HasTitle)
                {
                    chart.CategoryAxis.Title.Text.Text = widget.Properties.XAxis.Data.Title;
                    chart.CategoryAxis.Title.Text.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = widget.Properties.XAxis.Style.Label_FontSize;
                }
            }
        }

        XAxisProperties(chart, widget);
        Y1AxisProperties(chart, widget);
        Y2AxisProperties(chart, widget);

    }

@pkmark2,

I have observed your comments. Can you please share sample presentation and also please share which Aspose.Slides version you are using on your end.