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

Multiple Charts on one page

1 Answer 154 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Cory
Top achievements
Rank 1
Cory asked on 16 May 2016, 03:16 PM

I'm creating a dashboard and have a couple of DIVs defined... chart1, chart2.  I would like to fill them with RadCharts.

My problem is that when I draw the chart to the page - I only get one of them... the second on overwrites the first one.

Can you not have more than one radhtmlchart on a page???

I'm using a datatable from an oracle database to create the data... here is how the code is defined:

on ASP page:

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<div runat="server" id="Chart1">
Chart 1
</div>
<div runat="server" id="Chart2">
Chart 2
</div>
</asp:Content>

 

In Code Behind:

DataTable lPerson = app.GetPersonDashboard();
RadHtmlChart columnChart = new RadHtmlChart();
columnChart.ID = "ColumnChart";
columnChart.ChartTitle.Text = "EED Person Table Yesterday to Today (6 am)";
columnChart.Width = Unit.Pixel(350);
columnChart.Height = Unit.Pixel(300);
columnChart.Legend.Appearance.Position = Telerik.Web.UI.HtmlChart.ChartLegendPosition.Bottom;
//columnChart.PlotArea.XAxis.TitleAppearance.Text = "Record Type";
//columnChart.PlotArea.YAxis.TitleAppearance.Text = "Records Processed";
ColumnSeries ProcessedRecords = new ColumnSeries();
ProcessedRecords.Name = "Processed Records";
ProcessedRecords.LabelsAppearance.Visible = false;
ProcessedRecords.TooltipsAppearance.Color = System.Drawing.Color.White;
ProcessedRecords.TooltipsAppearance.DataFormatString = "{0} Records";
ColumnSeries ErrorRecords = new ColumnSeries();
ErrorRecords.Name = "Error Records";
ErrorRecords.Appearance.FillStyle.BackgroundColor = Color.Violet;
ErrorRecords.LabelsAppearance.Visible = false;
ErrorRecords.TooltipsAppearance.Color = System.Drawing.Color.White;
ErrorRecords.TooltipsAppearance.DataFormatString = "{0} Records";
foreach (DataRow row in lPerson.Rows)
{
decimal RecCount = (decimal)row["record_count"];
if (row["table_name"].ToString() == "ProcessCount")
{
CategorySeriesItem ProcCount = new CategorySeriesItem(RecCount);
ProcessedRecords.SeriesItems.Add(ProcCount);
}
if (row["table_name"].ToString() == "ErrorCount")
{
CategorySeriesItem ErrCount = new CategorySeriesItem(RecCount);
ErrorRecords.SeriesItems.Add(ErrCount);
}
}
columnChart.PlotArea.Series.Add(ProcessedRecords);
columnChart.PlotArea.Series.Add(ErrorRecords);
Chart1.Controls.Add(columnChart);
// This is the second chart on the page
DataTable lEED = app.GetEEDBulkDashboard();
RadHtmlChart EEDChart = new RadHtmlChart();
EEDChart.ID = "ColumnChart";
EEDChart.ChartTitle.Text = "Bulk Email Table Errors";
EEDChart.Width = Unit.Pixel(350);
EEDChart.Height = Unit.Pixel(300);
EEDChart.Legend.Appearance.Position = Telerik.Web.UI.HtmlChart.ChartLegendPosition.Bottom;
foreach (DataRow row in lEED.Rows)
{
ColumnSeries EEDCol = new ColumnSeries();
EEDCol.Name = row["groupname"].ToString();
EEDCol.LabelsAppearance.Visible = false;
EEDCol.TooltipsAppearance.Color = System.Drawing.Color.White;
EEDCol.TooltipsAppearance.DataFormatString = "{0} Records";
decimal RecCount = (decimal)row["record_count"];
CategorySeriesItem RecCountCol = new CategorySeriesItem(RecCount);
EEDCol.SeriesItems.Add(RecCountCol);
EEDChart.PlotArea.Series.Add(EEDCol);
}
Chart2.Controls.Add(EEDChart);
}

 

 

Please help!

Thanks,
Cory

 

 

 

1 Answer, 1 is accepted

Sort by
0
Cory
Top achievements
Rank 1
answered on 16 May 2016, 04:43 PM
Ignore this post - it helps if each of them have their own ID!!!  moron.  Oh well.
Tags
Chart (HTML5)
Asked by
Cory
Top achievements
Rank 1
Answers by
Cory
Top achievements
Rank 1
Share this question
or