I am creating RadHTMLChart programmatically to generate a single line chart with date on the x-axis and integers on the Y axis.. Everything seems to be working correctly but when I look closer to the data points the graph does not seem to be drawing every singles data point from the source. I am attaching an screenshot of the generated chart . I know that between the firs tool tip ("58") and the second tool tip ("31) . I have some data points that fluctuate to 59 then back to 58 and then 59 again but I do not see this reflected on my graph. Does HtmlChart takes an avarage to draw the graph or how does it work? Please any help would be appreciate it.
The data source of the graph is obtained of a filtered CSV file.
Here is my code:
RadHtmlChart PowerChart =
new
RadHtmlChart();
PowerChart.ID =
"PowerChart"
;
PowerChart.Width = Unit.Pixel(1200);
PowerChart.Height = Unit.Pixel(500);
PowerChart.Transitions =
true
;
PowerChart.Skin =
"Silk"
;
PowerChart.Appearance.FillStyle.BackgroundColor = System.Drawing.Color.White;
PowerChart.ChartTitle.Appearance.Align = Telerik.Web.UI.HtmlChart.ChartTitleAlign.Center;
PowerChart.ChartTitle.Appearance.BackgroundColor = System.Drawing.Color.Transparent;
PowerChart.ChartTitle.Appearance.Position = Telerik.Web.UI.HtmlChart.ChartTitlePosition.Top;
LineSeries PowerChartLineSeries =
new
LineSeries();
//PowerChartLineSeries.DataFieldY = "BatteryCapacity"; // ??? mayb non global
PowerChart.PlotArea.XAxis.DataLabelsField =
"DateandTime"
;
PowerChart.PlotArea.XAxis.Type = Telerik.Web.UI.HtmlChart.AxisType.Date;
PowerChart.PlotArea.XAxis.TitleAppearance.Text =
"Date"
;
PowerChart.PlotArea.XAxis.MajorGridLines.Color = System.Drawing.ColorTranslator.FromHtml(
"#EFEFEF"
);
PowerChart.PlotArea.XAxis.MajorGridLines.Width = 1;
PowerChart.PlotArea.XAxis.MinorGridLines.Color = System.Drawing.ColorTranslator.FromHtml(
"#F7F7F7"
);
PowerChart.PlotArea.XAxis.MinorGridLines.Width = 1;
PlotBand yAxisPlotBandDanger =
new
PlotBand();
yAxisPlotBandDanger.Color = System.Drawing.ColorTranslator.FromHtml(
"#CC0000"
);
yAxisPlotBandDanger.Alpha = 190;
PlotBand yAxisPlotBandDanger2 =
new
PlotBand();
yAxisPlotBandDanger2.Color = System.Drawing.ColorTranslator.FromHtml(
"#CC0000"
);
yAxisPlotBandDanger2.Alpha = 190;
PlotBand yAxisPlotBandWarning =
new
PlotBand();
yAxisPlotBandWarning.Color = System.Drawing.Color.Yellow;
yAxisPlotBandWarning.Alpha = 190;
PlotBand yAxisPlotBandWarning2 =
new
PlotBand();
yAxisPlotBandWarning2.Color = System.Drawing.Color.Yellow;
yAxisPlotBandWarning2.Alpha = 190;
PowerChart.ChartTitle.Text =
"Batttery Capacity in the last month"
;
PowerChart.PlotArea.XAxis.BaseUnit = Telerik.Web.UI.HtmlChart.DateTimeBaseUnit.Days;
PowerChart.PlotArea.YAxis.Step = 10;
PowerChart.PlotArea.YAxis.MinValue = 0;
PowerChart.PlotArea.YAxis.MaxValue = 120;
yAxisPlotBandDanger.From = 0;
yAxisPlotBandDanger.To = 5;
yAxisPlotBandWarning.From = 5;
yAxisPlotBandWarning.To = 10;
PowerChart.PlotArea.YAxis.TitleAppearance.Text =
"Battery Capacity"
;
PowerChart.PlotArea.YAxis.LabelsAppearance.DataFormatString =
"{0}%"
;
PowerChart.PlotArea.YAxis.PlotBands.Add(yAxisPlotBandDanger);
PowerChart.PlotArea.YAxis.PlotBands.Add(yAxisPlotBandWarning);
PowerChartLineSeries.DataFieldY =
"BatteryCapacity"
;
PowerChart.PlotArea.Series.Add(PowerChartLineSeries);
HtmlChartHolder.Controls.Add(PowerChart);
PowerChart.DataSource = GetDataTableToGraph(4,
"BatteryCapacity"
);
PowerChart.DataBind();
public
DataTable GetDataTableToGraph(
int
option,
string
powerVariable)
{
DateTime olddate;
DataTable sourceTable =
new
DataTable();
sourceTable.Columns.AddRange(
new
DataColumn[] {
new
DataColumn(
"DateandTime"
,
typeof
(DateTime)),
new
DataColumn(
"BatteryCapacity"
,
typeof
(
int
)),
new
DataColumn(
"BatteryChargeState"
,
typeof
(
string
)),
new
DataColumn(
"BatteryStatus"
,
typeof
(
string
)),
new
DataColumn(
"BatteryVoltage"
,
typeof
(
double
)),
new
DataColumn(
"Temperature"
,
typeof
(
double
)),
new
DataColumn(
"InputVoltage"
,
typeof
(
double
)),
new
DataColumn(
"InputFrequency"
,
typeof
(
double
)),
new
DataColumn(
"OutputCurrent"
,
typeof
(
double
)),
new
DataColumn(
"OutputLoad"
,
typeof
(
int
)),
new
DataColumn(
"OutputSource"
,
typeof
(
string
)),
new
DataColumn(
"OutputVoltage"
,
typeof
(
double
)),
new
DataColumn(
"LRTLB"
,
typeof
(
string
))
});
try
{
string
directory = ReadPowerDisplayRegistry(
"Dir"
) +
"Service\\PWRDATA.csv"
;
string
[] fileContent = File.ReadAllLines(directory);
for
(
int
i = 2; i < fileContent.Count(); i++)
{
string
[] rowData = fileContent[i].Split(
','
);
sourceTable.Rows.Add(rowData);
}
string
[] selectedColumns =
new
[] {
"DateandTime"
, powerVariable };
DataTable newDt =
new
DataView(sourceTable).ToTable(
false
, selectedColumns);
if
(option == 0)
{
olddate = DateTime.Now.AddMinutes(-30);
}
else
if
(option == 1)
{
olddate = DateTime.Now.AddMinutes(-60);
}
else
if
(option == 2)
{
olddate = DateTime.Now.AddDays(-1);
}
else
if
(option == 3)
{
olddate = DateTime.Now.AddDays(-7);
}
else
{
olddate = DateTime.Now.AddMonths(-1);
}
newDt.DefaultView.RowFilter = String.Format(CultureInfo.InvariantCulture.DateTimeFormat,
"[DateandTime] >#{0}#"
, olddate);
//newDt.DefaultView.RowFilter = string.Format
return
newDt;
}
catch
{
return
null
;
}
}
I have a .NET 4.0 web application which implements an error handler within the Application_Error event of Global.asax.
When an exception occurs this intercepts it and sends me an email including a variety of information like the logged in user, the page the error occurred on, the contents of the session etc.
This is all great but there is some fundamental detail missing which I seem unable to locate, i.e. the name of the control or the value that caused it to be out of range:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|
Hi Everyone,
I'm sure this is an obvious question but how do I set a default time when a user selects a date.
I have 2 RadDateTimePicker controls on a page where the user selects a daterange.
When the user selects a From date I want to automatically set the time portion of the returned date to 0:00 and when the user selects a To date I want to default the time to 23:59.
What am I missing, surely there is a default Time property somewhere that controls the time portion of the date returned from the Calendar.
Many thanks
Antony
I have a Radgrid using automatic Update, and a custom Edit Form template. I need to pass all the values of an edited row so I can populate an email that will be sent to users from the code-behind. Using the code below that I have cobbled together from various posts, I can get all the row's current values, but not the updated values using the ItemUpdated event. Is there another event I can use, or different code to obtain Updated values for that row after my Edit Form is closed and database updated? I am new to this, so code examples are helpful. Thanks!
C#
public
void
RadGrid1_ItemUpdated(
object
sender, GridUpdatedEventArgs e)
{
GridEditFormItem item = (GridEditFormItem)e.Item;
GridDataItem parentItem = (GridDataItem)item.ParentItem;
string
emailFlag = parentItem[
"EmailToSalesFlag"
].Text;
{
if
(emailFlag ==
"true"
);
string
SU = parentItem[
"StockUnit"
].Text;
string
Make = parentItem[
"Make"
].Text;
string
Model = parentItem[
"Model"
].Text;
string
Description = parentItem[
"Description"
].Text;
string
Type = parentItem[
"Type"
].Text;
string
CustName = parentItem[
"CustName"
].Text;
string
Salesperson = parentItem[
"Salesperson"
].Text;
string
RecDate = parentItem[
"Rec_Date"
].Text;
string
InvDate = parentItem[
"Inv_Date"
].Text;
string
SpiffProg = parentItem[
"SpiffProg"
].Text;
string
SpiffAmt = parentItem[
"SpiffAmt"
].Text;
string
Notes = parentItem[
"Notes"
].Text;
string
Approved = parentItem[
"Approved"
].Text;
string
MgrNotes = parentItem[
"MgrNotes"
].Text;
string
Email = parentItem[
"Email"
].Text;
//Populate HTML email Body
PopulateBody(SU, Make, Model, Description, Type, CustName, Salesperson, RecDate, InvDate, SpiffProg, SpiffAmt, Notes, Approved, MgrNotes, Email);
}
}
Hello!
I have a weird problem with my radgrid. In one of my columns (GridBoundColumn), I can't insert the exclamation mark.
It seems like the combination (Shift + 1) is somehow blocked. I can't find anything related to this.
Every other keyboard combination is working. The only way I can add the exclamation mark is by copy paste.
Has anyone encountered this before ? Any help is appreciated!
Thank you!
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
ButtonType
=
"ToggleButton"
ToggleType
=
"CustomToggle"
>
<
ToggleStates
>
<
telerik:RadButtonToggleState
Selected
=
"true"
ImageUrl
=
"../images/ConfirmBtn-Grey.jpg"
/>
<
telerik:RadButtonToggleState
ImageUrl
=
"../images/ConfirmBtn-Selected.jpg"
/>
</
ToggleStates
>
</
telerik:RadButton
>