Hello,
I am creating htmlCharts dynamically from server side and trying to put a tooltip which shows both x and y axis values in the tooltip label.
As everything is dynamic, I can only code from the server side. I tried using
areaSeries.TooltipsAppearance.DataFormatString = "{0}% FCI in {1}Year";
but it looks like that we can't use {1} for areaSeries.
Then I tried using clientTemplate following the demo:
http://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/clienttemplates/defaultcs.aspx
but none of these tell how to code purely from server side. I am pasting my concerned code for better insight
//To create chart
RadHtmlChart htmlChartACIOverStudyPeriod = CreateHtmlChart("Year", "FCI", "%");
htmlChartACIOverStudyPeriod.ChartTitle.Text = "FCI Over Study Period";
htmlChartACIOverStudyPeriod.ID = "rhcFCIOverStudyPeriod";
//To clear the plotarea and xaxis for the chart
htmlChartACIOverStudyPeriod.PlotArea.XAxis.Items.Clear();
htmlChartACIOverStudyPeriod.PlotArea.Series.Clear();
//To check if datatable has some value for selected agency and facility
if (dtCurEstTotalOverStudyPeriod.Rows.Count > 0)
{
int rowCount = 0;
ColumnSeries columnSeries = new ColumnSeries();
columnSeries.LabelsAppearance.Visible = false;
// columnSeries.TooltipsAppearance.DataFormatString = "{0}% FCI in {1}Year";
columnSeries.TooltipsAppearance.ClientTemplate = " #=dataItem.CurEstTotal# justForTest";
for (Int32 intCurrent = intFiscalYear; intCurrent <= intMaxYear; intCurrent++)
{
htmlChartACIOverStudyPeriod.PlotArea.XAxis.Items.Add(new AxisItem(intCurrent.ToString()));
decimal ACI = 0;
CategorySeriesItem categorySeriesItem = new CategorySeriesItem();
//to check if row in the table exists
if (rowCount < dtCurEstTotalOverStudyPeriod.Rows.Count)
{
if (dtCurEstTotalOverStudyPeriod.Rows[rowCount]["AnoFiscalYear"].Equals(intCurrent))
{
//To plot the y-axis
ACI = (Convert.ToDecimal(dtCurEstTotalOverStudyPeriod.Rows[rowCount]["CurEstTotal"]) / CurEstReplOverStudyPeriod) * 100;
rowCount++;
}
else
{
ACI = 0;
}
categorySeriesItem.Y = Math.Round(ACI, 3);
columnSeries.SeriesItems.Add(categorySeriesItem);
}
}
htmlChartACIOverStudyPeriod.PlotArea.Series.Add(columnSeries);
}
dockA2.ContentContainer.Controls.Add(htmlChartACIOverStudyPeriod);
this results into attached snapshot. Please help me to get x-axis value in the tooltip of ColumnChart.
Thnaks,
Somya