Hi , help to change the RadChart To RadHtmlChart for line chart series , below is the existing code used RadChart . i need to update to RadHtmlChart
hartAnalysis_BLL objBLL = new ChartAnalysis_BLL();
DataTable dt = objBLL.GetMonthlySSMTotalQuantityImported(arrParameters);
// Create new chart
RadChart2.ChartTitle.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font(RadChart2.ChartTitle.TextBlock.Appearance.TextProperties.Font.FontFamily, 11, System.Drawing.FontStyle.Bold);
RadChart2.ChartTitle.TextBlock.Text = "Extended Monthly SSM Total Quantity Imported \n(" + ssm[0] + ")";
RadChart2.Width = AppConstants.CONST_CHART_WIDTH;
RadChart2.ChartTitle.Visible = true;
RadChart2.Chart.DefaultType = ChartSeriesType.Line;
RadChart2.PlotArea.Appearance.Dimensions.Margins.Left = Telerik.Charting.Styles.Unit.Percentage(10);
RadChart2.PlotArea.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.Unit.Percentage(15);
RadChart2.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.Unit.Percentage(30);
RadChart2.DataManager.ValuesXColumn = "Date";
RadChart2.DataManager.ValuesYColumns = new string[1] { "SSM Quantity" };
RadChart2.IntelligentLabelsEnabled = true;
RadChart2.DataSource = dt;
RadChart2.DataBind();
RadChart2.Skin = AppConstants.CONST_TELERIK_CHARTSKIN;
RadChart2.PlotArea.XAxis.Clear();
RadChart2.PlotArea.XAxis.IsZeroBased = false;
RadChart2.PlotArea.XAxis.AutoScale = false;
RadChart2.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate;
RadChart2.PlotArea.XAxis.Appearance.CustomFormat = "MMM yy";
RadChart2.PlotArea.XAxis.AxisLabel.Visible = true;
RadChart2.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Month \n(" + AppFunctions.GetDisclaimer() + ")";
RadChart2.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Black;
RadChart2.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = -45;
RadChart2.PlotArea.YAxis.AxisLabel.Visible = true;
RadChart2.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Total Quantity of SSM Imported (" + dt.Rows[0]["UOM"] + ")";
RadChart2.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Black;
RadChart2.Series.GetSeries(0).Appearance.PointMark.Dimensions.Width = 1;
RadChart2.Series.GetSeries(0).Appearance.PointMark.Dimensions.Height = 1;
RadChart2.Series.GetSeries(0).Appearance.PointMark.FillStyle.MainColor = System.Drawing.Color.Black;
RadChart2.Series.GetSeries(0).Appearance.PointMark.FillStyle.FillType = FillType.Solid;
RadChart2.Series.GetSeries(0).Appearance.PointMark.Visible = true;
RadChart2.Series.GetSeries(0).Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Orange;
RadChart2.Series.GetSeries(0).Appearance.LineSeriesAppearance.Width = 3;
int intYear = dt_SelDateFrom.Year;
int intMonth = dt_SelDateFrom.Month;
DateTime start = new DateTime(intYear, intMonth, 1);
TimeSpan ts = dt_SelDateTo - dt_SelDateFrom;
int intMthDiff = Convert.ToInt32(Math.Ceiling((ts.TotalDays / 30)));
for (int i = 0; i < intMthDiff; i++)
{
ChartAxisItem item = new ChartAxisItem();
item.Value = (decimal)start.AddMonths(i).ToOADate();
RadChart2.PlotArea.XAxis.AddItem(item);
}
DataTable dt_avg = objBLL.GetSSMTotalImportedLastYearAverage(arrParameters);
// Define chart series
ChartSeries avg_series = new ChartSeries();
avg_series.Appearance.LabelAppearance.Visible = false;
avg_series.Name = "Last Year Average";
avg_series.Type = ChartSeriesType.Line;
avg_series.Appearance.PointMark.Dimensions.Width = 1;
avg_series.Appearance.PointMark.Dimensions.Height = 1;
avg_series.Appearance.PointMark.FillStyle.MainColor = System.Drawing.Color.Black;
avg_series.Appearance.PointMark.FillStyle.FillType = FillType.Solid;
avg_series.Appearance.PointMark.Visible = true;
avg_series.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Red;
foreach (DataRow row in dt_avg.Rows)
{
foreach (DataColumn col in dt_avg.Columns)
{
Decimal dec_data = Convert.ToDecimal(row[col]);
Double dbl_data = Convert.ToInt32(dec_data);
avg_series.AddItem(dbl_data);
}
}
RadChart2.AddChartSeries(avg_series);
ArrayList arrParameterBaseline = new ArrayList();
arrParameterBaseline.Add(dt_SelBaselineFrom);
arrParameterBaseline.Add(dt_SelBaselineTo);
arrParameterBaseline.Add(dt_SelSSMSeqID);
SqlDataReader dr_baseline = objBLL.GetSSMTotalImportedBaseline(arrParameterBaseline);
ChartSeries baseline_series = new ChartSeries();
baseline_series.Appearance.LabelAppearance.Visible = false;
baseline_series.Name = "Baseline Average";
baseline_series.Type = ChartSeriesType.Line;
baseline_series.Appearance.PointMark.Dimensions.Width = 1;
baseline_series.Appearance.PointMark.Dimensions.Height = 1;
baseline_series.Appearance.PointMark.FillStyle.MainColor = System.Drawing.Color.Black;
baseline_series.Appearance.PointMark.FillStyle.FillType = FillType.Solid;
baseline_series.Appearance.PointMark.Visible = true;
baseline_series.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Chartreuse;
Double dbl_baseline = 0;
if (dr_baseline == null)
{
dbl_baseline = 0;
}
else
{
try
{
while (dr_baseline.Read())
{
if (dr_baseline["TotalImportedBaseline"] == DBNull.Value)
dbl_baseline = 0;
else
{
Decimal dec_baseline = dr_baseline.GetDecimal(dr_baseline.GetOrdinal("TotalImportedBaseline"));
dbl_baseline = Convert.ToDouble(dec_baseline);
}
}
}
catch (Exception ex)
{
AppFunctions.SetMessageError(this.Page, AppConstants.CONST_ERROR_LOAD_CHART);
AppFunctions.ErrorLog(ex);
}
finally
{
if (dr_baseline != null)
{
dr_baseline.Close();
dr_baseline.Dispose();
}
}
}
for (int i = 0; i < intMthDiff; i++)
{
baseline_series.AddItem(dbl_baseline);
}
RadChart2.AddChartSeries(baseline_series);
Panel1.Controls.Add(RadChart2);
}
catch (Exception ex)
{
AppFunctions.SetMessageError(this.Page, AppConstants.CONST_ERROR_LOAD_CHART);
AppFunctions.ErrorLog(ex);
}
The charts starts to perform zooming when the user pans with one finger in touch devices.
Steps to reproduce:
1. Open the following demo in a touch device (or Chrome simulator)
https://demos.telerik.com/aspnet-ajax/htmlchart/examples/functionality/pan-zoom/defaultcs.aspx
2. Start panning until the zooming issue occurs
Video: http://somup.com/cr6lo73b73
I have an htmlchart using a scatter series and a radgrid, on the grid row hover event I call the below javascript function to show the relevant tooltip for the plotted point matching the id of the grid row.
function showToolTip(eventArgs, chart, plotXvalue, plotYvalue) {
This all works well, however I would like to also highlight the plotted point that the tooltip relates to, the same effect as the mouse over on the point within the chart.
We want the Kendo chart widget (RadHtmlChart actually) to blend in with the webpage we use it in. In this page, we use font-weight 300. Since there is no way to specify the font-weight in the chart, we have had to use a hack to specify it:
function chartLoad(chart, args) {
chart.get_kendoWidget().setOptions({ title: { font: "20px sans-serif; font-weight: 300" }});
}
This is not only a clumpsy hack, but it also make use of a custom skin impossible (for setting the font).
Hello,
I would like to highlight a GridLine based on a Labelled item when I have implemented skip in the HTML Chart.
Essentially, I have a series of days and would like to step the labels on a weekly basis. At each step I would like to highlight the GridLine associated with the label.
Label position dynamic. I'm currently using "InsideBase", but if those values are so small it's not very visible, so i'd like place those on the outside end.
I get a lot of work creating BI/KPI UIs which are basically converting what you can do in Excel Charts into a Web UI. Which means anything they can do in Excel they expect the web to do. Since there is a drive to automate as much mundane human activity in the business and reduce human error (cut and paste error). I need to reproduce a graph with 'standard' Tend Lines. That is not my interpretation of a trend, but standard best practice. I want this as a checkbox, and attribute to a series for the DataFieldY value. Initially a code solution would be fine (once its got the data from the data source). http://www.telerik.com/blogs/how-to-plot-a-simple-linear-regression-in-telerik-asp.net-web-form-chart
It would be helpful to have a way to set the major tick step value via the RadHtmlChart control. This can be set on the client side, but it seems like a missing feature since I can change the major tick size and label step values via the control axis attributes. Here's an example with my suggested attribute shown in comments on the xAxis below. <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" DataSourceID="RequestDays"> <ClientEvents OnLoad="OnLoad" /> <PlotArea> <Series> <telerik:AreaSeries Name="Last Year" DataFieldY="Last"></telerik:AreaSeries> <telerik:AreaSeries Name="Current Year" DataFieldY="Current"></telerik:AreaSeries> </Series> <XAxis Name="Days" DataLabelsField="Days" MajorTickSize="5"> <%--MajorTickStep="7"--%> <LabelsAppearance Step="14" /> </XAxis> </PlotArea> </telerik:RadHtmlChart> <script type="text/javascript"> function OnLoad(chart) { var widget = chart.get_kendoWidget(); widget.options.categoryAxis.majorTicks = { step: 7 }; widget.redraw(); } </script>
Currently, the RadHtmlChart control allows you to create a spline series to display. But sometimes, we need the curve to follow more of a Bezier path because the points in the series aren't necessarily the local min/max for the neighborhood around them. This would function much like the smooth line that appears in Excel's scatter chart type or the ChartFX control's curve gallery type.
Add support for a secondary x-axis at the top of the chart. Please use consistent axis types. Why would the primary axes be of type Telerik.Web.UI.HtmlChart.PlotArea.Chart*Axis and the secondary y-axis be of type Telerik.Web.UI.AxisY?
Right now we do not have a way to show some tooltips over Axis Labels This is useful when we have big names for Axis Labels, we can put some short cut names be default and then show full name over tool tip. We can use Series tooltip, but it looks ugly for stacked series when you have 4 to 5 series
When migrating from a GeckoBoard.com dashboard, I have a Area Chart where the values over the target are one colour and those below another colour, this is true of Area and Bar charts. At the moment I can use the "'ColorField="ErrorsColor"> " to colour the whole column to a given colour, but not that part above its Target. One approach could be is to have 2 plots one below the target and one above the target, I would prefer to be this in control of the HtmlChart and for me not to frig it. Thanks
Hi, What I see in the HTML chart control is almost what I need. The closest that I can get to a "generic chart" (with everything specified in the data) is binding to the XMLDataSource, but even with that, it appears that the Series Name needs to be hard-coded (not included in the XML data) or we need to write code to replace a hard-coded value with an "out of band" supplied value for each of the series names. I've been looking through all of the demos and it appears that in every one of them, labels or titles that appear on the graph show up in the code somewhere. Then when I look at the documentation, there is no place where those labels or titles can be extracted from the data source. This would indicate to me that every graph needs to be hard-coded. Am I missing something? I hope so. We have potentially thousands of graphing possibilities that we need to implement and would like the user to be able to design their own and this control looks pretty good, except for the "hard-coding" thing. If we could retrieve the series names from the XML input, the task would take days; if we need to individually code each chart, it will take months to staff-years. Here is a sample of what the XML input could look like: <chart caption='Error Summary by Day'> <categories> <category label='Nov+11' /> <category label='Nov+12' /> <category label='Nov+13' /> <category label='Nov+14' /> <category label='Nov+15' /> <category label='Nov+16' /> <category label='Nov+17' /> <category label='Nov+18' /> <category label='Nov+19' /> <category label='Nov+20' /> <category label='Nov+21' /> <category label='Nov+22' /> <category label='Nov+23' /> <category label='Nov+24' /> <category label='Nov+25' /> <category label='Nov+26' /> <category label='Nov+27' /> <category label='Nov+28' /> <category label='Nov+29' /> <category label='Nov+30' /> </categories> <dataset seriesname='Notes'> <set value='0' /> <set value='0' /> <set value='0' /> <set value='3' /> <set value='3' /> <set value='4' /> <set value='5' /> <set value='5' /> <set value='3' /> <set value='3' /> <set value='2' /> <set value='2' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> </dataset> <dataset seriesname='Warnings'> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='2' /> <set value='2' /> <set value='3' /> <set value='3' /> <set value='4' /> <set value='4' /> <set value='5' /> <set value='6' /> <set value='4' /> <set value='3' /> <set value='2' /> <set value='0' /> <set value='0' /> <set value='0' /> <set value='0' /> </dataset> <dataset seriesname='Errors'> <set value='74' /> <set value='74' /> <set value='74' /> <set value='74' /> <set value='76' /> <set value='76' /> <set value='76' /> <set value='71' /> <set value='71' /> <set value='64' /> <set value='64' /> <set value='64' /> <set value='54' /> <set value='44' /> <set value='44' /> <set value='31' /> <set value='31' /> <set value='21' /> <set value='22' /> <set value='12' /> </dataset> </chart> You would use an XML attribute to specify series and chart names. Thanks, Rob
When using the RadHtmlChart RadarSeries the axis are default drawn like a spiders web. (see screenshot) A common request is that axis lines for this type of graph are drawn as circles (represending more a Radar type look). This can currently be achieved by accessing the Kendo widget like so: $find('RadarAreaChart').get_kendoWidget().options.valueAxis.majorGridLines.type="arc"; $find('RadarAreaChart').get_kendoWidget().options.valueAxis.minorGridLines.type="arc"; $find('RadarAreaChart').get_kendoWidget().redraw(); But it would be VERY convenient (and probably very easy to implement for you guys :-) if it was a setting on the RadarSeries itself (or perhaps on the axis of the RadarSeries. E.g. property on RadarSeries called AxisType with values (Spider or Radar). Best Regards Thomas
The selection (http://demos.telerik.com/kendo-ui/chart-api/selection) can be configured through the kendo widget: <script> function pageLoad(args) { var kendoWidget = $find("<%=RadHtmlChart1.ClientID%>").get_kendoWidget(); kendoWidget.options.categoryAxis.select = { from: 1, to: 2 }; kendoWidget.bind("selectStart", onSelectStart); kendoWidget.bind("select", onSelect); kendoWidget.bind("selectEnd", onSelectEnd); kendoWidget.redraw(); } function formatRange(e) { var categories = e.axis.categories; return kendo.format("{0} - {1} ({2} - {3})", e.from, e.to, categories[e.from], // The last category included in the selection is at (to - 1) categories[e.to - 1] ); } function onSelectStart(e) { console.log(kendo.format("Select start :: {0}", formatRange(e))); } function onSelect(e) { console.log(kendo.format("Select :: {0}", formatRange(e))); } function onSelectEnd(e) { console.log(kendo.format("Select end :: {0}", formatRange(e))); } </script> <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="600px" Height="400px"> <PlotArea> <Series> <telerik:ColumnSeries Name="Product 1"> <SeriesItems> <telerik:CategorySeriesItem Y="1" /> <telerik:CategorySeriesItem Y="2" /> <telerik:CategorySeriesItem Y="3" /> <telerik:CategorySeriesItem Y="4" /> <telerik:CategorySeriesItem Y="2" /> </SeriesItems> </telerik:ColumnSeries> </Series> <XAxis> <Items> <telerik:AxisItem LabelText="1" /> <telerik:AxisItem LabelText="2" /> <telerik:AxisItem LabelText="3" /> <telerik:AxisItem LabelText="4" /> <telerik:AxisItem LabelText="5" /> </Items> </XAxis> </PlotArea> </telerik:RadHtmlChart>