HtmlChart does not visualize data

3 posts, 0 answers
  1. Yuri
    Yuri avatar
    2 posts
    Member since:
    Feb 2013

    Posted 01 Aug 2013 Link to this post

    Hello, i have a problem with RadHtmlChart . In several cases it does not visualize simple data. By the link (http://www.4shared.com/zip/VwnV4RZf/RadHtmlChartErr2013.html)  you can download simple project where i reproduce the problem. All the logic related to problem is inplemented in the default.aspx.cs 
    There is a data file attached a to which the link had been made where the problem reproduces and there is a data file also where the problem does not reproduce.

    Best Regards.
  2. Yuri
    Yuri avatar
    2 posts
    Member since:
    Feb 2013

    Posted 02 Aug 2013 Link to this post

    The bug was related to dynamic implementation of tooltip instead of tie it to DataTable using databind
    http://www.telerik.com/help/aspnet-ajax/htmlchart-client-templates-for-tooltips-and-labels.html ). 

    // clear the chart series collection and add our new series.
                riskReturnChart.PlotArea.Series.Clear();
                 
                // select all Risk/Returns in sorted collection.
                var seriesValues = Positions;
     
                _risk_return_dt = new DataTable();
                     
                object[] array = new object[seriesValues.Count() * 3];
                // load series items.
                int i = 0;
                foreach (var position in seriesValues)
                {
                 //   _risk_return_dt.Columns.Add("id"+i);
                    _risk_return_dt.Columns.Add("xValues" + i);
                    _risk_return_dt.Columns.Add("yValues" + i);
                    _risk_return_dt.Columns.Add("tooltip" + i);
                 //   _risk_return_dt.Columns.Add("yValues" + i);
                    
     
                    array[i * 3] = position.x;
                    array[i * 3 + 1] = position.y;
                    array[i * 3 + 2] = String.Format("<strong>{0}</strong><br / >{1}<br />{2}%",
                        position.Symbol, position.Name, position.x);
                    i++;
                }
                _risk_return_dt.Rows.Add(array);
     
                i = 0;
                // load series items.
                foreach (var position in seriesValues)
                {
                    // create the series and set its values.
                    ScatterSeries series = new ScatterSeries();
     
                    series.Name = position.Symbol;
                    series.LabelsAppearance.Visible = false;
                    series.MarkersAppearance.BackgroundColor = Color.Black;
                    // Set value to 0 if NaN double value

                    series.DataFieldX = "xValues"+i;
                    series.DataFieldY = "yValues"+i;
                    series.TooltipsAppearance.ClientTemplate = "#=dataItem.tooltip"+i+"#";
                     
                    string pColor = position.Color;
                    series.Appearance.FillStyle.BackgroundColor = System.Drawing.ColorTranslator.FromHtml(pColor);
                    // add the serie to the chart.
                    riskReturnChart.PlotArea.Series.Add(series);
                    i++;
                }
     
                riskReturnChart.DataSource = _risk_return_dt;
                riskReturnChart.DataBind();

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stamo Gochev
    Admin
    Stamo Gochev avatar
    157 posts

    Posted 06 Aug 2013 Link to this post

    Hello Yuri,

    I wasn't able to download the project from the link you provided. Could you give me a detailed explanation of both the problem and the two "data files" - the one which reproduces the issue and the one that works OK?

    Meanwhile, I have created a sample page where I create a data bound ScatterSeries which uses the ClientTemplate property of the ToolTipsAppearance. Could you have a look at it and try to modify the scenario, so that it reproduces your issue? It would be very helpful if you send me back the modified version of the code so I can investigate the case and give you further suggestions.

    Regards,
    Stamo Gochev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top