I have a seemingly simple requirement. I want a tooltip to popup when the user hovers over a charted datapoint (2d column chart).
All the examples I've found (including feature brower) show tooltips set at the (hard coded) datapoint object. However, I'm adding the series to the chart in code behind by mapping to columns in DataTable and setting tooltips for the individual datapoints doesn't work.
How do I bind tooltips to the column value? I would think this is a no brainer... but I'm stumped!
Thanks in advance for the help.
So far, so good. Indeed, that does get me 1 step closer. My decimal data values now shows up as a tooltip.
Now I need to format my decimal values as currency. I'm trying to follow some forum data template examples, but am having difficulty because I'm charting multiple series (data columns) so the column names are different for each column.
I'm loading the series with the following code:
for (int i = 1; i < dt.Columns.Count - 1; i++) { seriesTaxBrackets = new Series(); seriesTaxBrackets.ChartType = ChartType.Column; seriesTaxBrackets.DataSource = dt; seriesTaxBrackets.DataMapping = "Value=" + dt.Columns[i].ColumnName + ";Tooltip=" + dt.Columns[i].ColumnName; seriesTaxBrackets.Label = (string)FindResource("Bracket") + " " + i.ToString(); seriesTaxBrackets.StrokeThickness = .5d; chartTaxBrackets.Series.Add(seriesTaxBrackets);}
Do you know where I can squeeze in a String.Format command that will get applied to the rendered tooltip?
Thanks again.
You should be able to specify the tooltip mapping in the DataMapping string. See if this works for you:<igChart:XamChart x:Name="chart"> <igChart:XamChart.Series> <igChart:Series ChartType="Column"/> </igChart:XamChart.Series></igChart:XamChart>
DataTable dt = new DataTable();dt.Columns.Add("label", typeof (string));dt.Columns.Add("value", typeof (double));dt.Rows.Add(new object[] {"item1", 3});dt.Rows.Add(new object[] {"item2", 7});dt.Rows.Add(new object[] {"item3", 2});dt.Rows.Add(new object[] {"item4", 8});
Series series = chart.Series[0];series.DataSource = dt;series.DataMapping = "Label=label;Value=value;Tooltip=value";