I'm trying to do a RadHtmlChart with Telerik in a Telerik Web project, so far it was working but for some reason the loading of the series dots is not happening anymore, and for all honesty, I don't know where to look anymore.
Here is the code (of the method who include all configuration and load of the RadHTMLChart):
private void LoadChartG1()
{
chartEjercicios.Appearance.FillStyle.BackgroundColor = Color.White;
List<ItemEmbalseCota> newListCota = new List<ItemEmbalseCota>();
List<ItemAbstract> newListPeriodosBaseXAxis = new List<ItemAbstract>();
if (rcbxEjercicioMultiple.CheckedItems.Count() <= 0)
{
rcbxEjercicioMultiple.Items.Where(c => c.Value == /*DateTime.Now.ToString("yyyy")*/"2016").FirstOrDefault().Checked = true;
}
newListCota.Clear();
foreach (var item in rcbxEjercicioMultiple.CheckedItems)
{
if (!(rcbxEjercicioMultiple.CheckedItems.Count <= 0))
{
//This method load the info from a Web-Server database from the year that correspond
newListCota = new ExcelInfo().OBT_R06_EmbalseCorrespondienteConCotasAnno(Convert.ToInt32(rcbxEmbalse.SelectedValue), Convert.ToInt32(item.Value));
}
}
//set up chart title
var chartTitle = chartEjercicios.ChartTitle;
chartTitle.Text = "Server CPU Load by Days";
chartTitle.Appearance.Align = ChartTitleAlign.Center;
chartTitle.Appearance.BackgroundColor = Color.White;
chartTitle.Appearance.Position = ChartTitlePosition.Top;
//set up chart legend
var legend = chartEjercicios.Legend;
legend.Appearance.BackgroundColor = Color.White;
legend.Appearance.Position = ChartLegendPosition.Bottom;
//set up plot area
var plotArea = chartEjercicios.PlotArea;
plotArea.Appearance.FillStyle.BackgroundColor = Color.YellowGreen;
//set up x-axis
var xAxis = plotArea.XAxis;
xAxis.AxisCrossingValue = 0;
xAxis.Color = Color.Black;
xAxis.MajorTickType = TickType.Outside;
xAxis.MinorTickType = TickType.None;
xAxis.Reversed = false;
var axisItemCollection = xAxis.Items;
//Loader of days in X axis by appearance (Not really dates)
axisItemCollection.Clear();
for (decimal i = radSliderVisualizadorG1DesdeHasta.SelectionStart ; i <= radSliderVisualizadorG1DesdeHasta.SelectionEnd; i++)
{
axisItemCollection.Add(new AxisItem(i.ToString()));
}
int FechaInicio = new ExcelInfo().OBT_R06_FechakeyPorNumerodiaAnnoViceVersa((int)radSliderVisualizadorG1DesdeHasta.SelectionStart, false).ID;
int FechaTermino = new ExcelInfo().OBT_R06_FechakeyPorNumerodiaAnnoViceVersa((int)radSliderVisualizadorG1DesdeHasta.SelectionEnd, false).ID;
xAxis.MinDateValue = DateTime.ParseExact(FechaInicio.ToString(), "yyyyMMdd",null);
xAxis.MaxDateValue = DateTime.ParseExact(FechaTermino.ToString(), "yyyyMMdd", null);
xAxis.MaxDateGroups=25;
xAxis.EnableBaseUnitStepAuto = true;
xAxis.Type = AxisType.Date;
xAxis.DataLabelsField = "OrderDate";
xAxis.LabelsAppearance.DataFormatString = "dd-MM";
xAxis.LabelsAppearance.RotationAngle = 0;
xAxis.TitleAppearance.Text = "Days of the Year";
xAxis.TitleAppearance.Position = AxisTitlePosition.Center;
xAxis.MajorGridLines.Visible = true;
xAxis.MinorGridLines.Visible = true;
xAxis.MajorGridLines.Width = 1;
xAxis.MinorGridLines.Width = 1;
//set up y-axis
var yAxis = plotArea.YAxis;
yAxis.LabelsAppearance.RotationAngle = -35;
yAxis.Color = Color.Black;
yAxis.MajorTickType = TickType.Outside;
yAxis.MinorTickType = TickType.None;
decimal? MaxComparitor = 0;
decimal? MinComparitor = 99999999;
decimal? MaxInList = 0;
decimal? MinInList = 0;
foreach (var item in newListCota)
{
var someString = item.ID_FechaKey.ToString().Substring(0, 6);
if (item.CotaValor < MinComparitor)
{
MinComparitor = MinInList = (decimal?)item.CotaValor;
}
if (item.CotaValor > MaxComparitor)
{
MaxComparitor = MaxInList = (decimal?)item.CotaValor;
}
}
yAxis.MaxValue = MaxInList+((MaxInList*10)/100)+15;
yAxis.MinValue = ((MinInList * 10) / 100);
#region No Use Code for assign Y Axis
//This is the old min-max values of the Y side
//yAxis.MaxValue = 100;
//yAxis.MinValue = 0;
#endregion
yAxis.Step = ((MinInList * 15) / 100);
yAxis.LabelsAppearance.DataFormatString = "{0}";
yAxis.MajorGridLines.Width = 1;
yAxis.MinorGridLines.Width = 1;
yAxis.TitleAppearance.Text = "CPU Load";
yAxis.TitleAppearance.Position = AxisTitlePosition.Center;
//set up series
var series = plotArea.Series;
series.Clear();
//Here i take the number from certain range of date to another, this used to work fine before I add the MaxDateGroups and EnableAuto
newListCota = newListCota.Where(c => c.DiasEnAnno >= ((Int32)radSliderVisualizadorG1DesdeHasta.SelectionStart) && c.DiasEnAnno <= ((Int32)radSliderVisualizadorG1DesdeHasta.SelectionEnd)).ToList();
foreach (var itemEM in rcbxEjercicioMultiple.CheckedItems)
{
var barSeries = new AreaSeries();
barSeries.LabelsAppearance.Visible = false;
barSeries.LabelsAppearance.DataFormatString = "{0}";
barSeries.MarkersAppearance.Visible = false;
barSeries.Appearance.FillStyle.BackgroundColor = ColorTranslator.FromHtml(ColorRandomizer());
//barSeries.LineAppearance.LineStyle = Telerik.Web.UI.HtmlChart.Enums.ExtendedLineStyle.Normal;
barSeries.Name = "Año "+ itemEM.Value;
foreach (var item in newListCota)
{
barSeries.Items.Add(new SeriesItem(item.CotaValor));
}
series.Add(barSeries);
}
}
Other relevant information
I suspect that the problem can be a property of the Series I choose than I must active or change, because this start to happening when I add this to the code in order to load the X axis in a more appropriate way, but don't know for certain:
xAxis.MaxDateGroups=25; xAxis.EnableBaseUnitStepAuto = true;
The DB from where I consume the data as well as the call of that data is perfectly fine, I verify it.
Any suggest, question, request of clarification or answer than help to find the solution would be much appreciated too.