This is a migrated thread and some comments may be shown as answers.

HtmlChart does not visualize data

2 Answers 51 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Yuri
Top achievements
Rank 1
Yuri asked on 01 Aug 2013, 05:42 PM
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 Answers, 1 is accepted

Sort by
0
Yuri
Top achievements
Rank 1
answered on 02 Aug 2013, 08:04 AM
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();

0
Stamo Gochev
Telerik team
answered on 06 Aug 2013, 10:30 AM
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.
Tags
Chart (HTML5)
Asked by
Yuri
Top achievements
Rank 1
Answers by
Yuri
Top achievements
Rank 1
Stamo Gochev
Telerik team
Share this question
or