I have a bar chart that has a single series of labels that come from a data source. Some of the labels are too long, and I am trying to wrap the text, as shown in this demo:
http://docs.telerik.com/devtools/aspnet-ajax/controls/htmlchart/functionality/multiline-labels
I was able to get the demo to work by just inserting the markup, but when I try to make text wrap in my own code, I get a javascript error. (Unterminated string constant)
I have simplified my code to give an example of what is happening. Here is the markup:
<
telerik:RadHtmlChart
ID
=
"barChart"
Transitions
=
"true"
Skin
=
"Silk"
Height
=
"500"
runat
=
"server"
>
<
ChartTitle
>
<
Appearance
>
<
TextStyle
Bold
=
"true"
FontSize
=
"14"
/>
</
Appearance
>
</
ChartTitle
>
<
Legend
>
<
Appearance
Position
=
"Bottom"
Visible
=
"false"
></
Appearance
>
</
Legend
>
<
PlotArea
>
<
XAxis
>
<
TitleAppearance
>
<
TextStyle
Bold
=
"true"
FontSize
=
"12"
/>
</
TitleAppearance
>
<
LabelsAppearance
Visible
=
"true"
>
<
TextStyle
Bold
=
"true"
FontSize
=
"10"
/>
</
LabelsAppearance
>
<
MajorGridLines
Visible
=
"false"
/>
<
MinorGridLines
Visible
=
"false"
/>
</
XAxis
>
<
YAxis
MajorTickType
=
"None"
>
<
TitleAppearance
>
<
TextStyle
Bold
=
"true"
FontSize
=
"12"
/>
</
TitleAppearance
>
<
LabelsAppearance
>
<
TextStyle
Bold
=
"true"
FontSize
=
"10"
/>
</
LabelsAppearance
>
<
MajorGridLines
Visible
=
"true"
/>
<
MinorGridLines
Visible
=
"false"
/>
</
YAxis
>
</
PlotArea
>
</
telerik:RadHtmlChart
>
Here is the relevant code on the server. I have seen posts from 2013 that said this is not possible, but the 2014 demo implies that you have resolved he issue:
public void CreateChart(ChartEventArgs args)
{
barChart.PlotArea.Series.Clear();
//var ds = _presenter.GenerateChart(args);
barChart.PlotArea.XAxis.Name = "Workflow Step";
barChart.PlotArea.XAxis.DataLabelsField = "WorkflowStep";
AddChartSeries("WorkflowStep", "AvgDaysToCSR", "{0:N2}", Color.FromArgb(245, 234, 105));
var average = new List<
ChartRequestTypeResult
>();
// Works, but doesn't wrap
//average.Add(new ChartRequestTypeResult { WorkflowStepID = 1, WorkflowStep = "Test Wrap One", AvgDaysToCSR = 1.0 });
//average.Add(new ChartRequestTypeResult { WorkflowStepID = 2, WorkflowStep = "Test Wrap Two", AvgDaysToCSR = 2.0 });
//average.Add(new ChartRequestTypeResult { WorkflowStepID = 3, WorkflowStep = "Test Wrap Three", AvgDaysToCSR = 3.0 });
// Gives error
average.Add(new ChartRequestTypeResult { WorkflowStepID = 1, WorkflowStep = "Test\nWrap\nOne", AvgDaysToCSR = 1.0 });
average.Add(new ChartRequestTypeResult { WorkflowStepID = 2, WorkflowStep = "Test\nWrap\nTwo", AvgDaysToCSR = 2.0 });
average.Add(new ChartRequestTypeResult { WorkflowStepID = 3, WorkflowStep = "Test\nWrap\nThree", AvgDaysToCSR = 3.0 });
barChart.DataSource = average;
barChart.DataBind();
BackgroundColor = Color.FromArgb(208, 212, 204);
}
public void AddChartSeries(string name, string seriesValue, string format, Color color)
{
ColumnSeries cs = new ColumnSeries();
cs.Name = name;
cs.Stacked = false;
cs.Spacing = 0.0;
cs.Gap = 0.2;
cs.DataFieldY = seriesValue;
cs.Appearance.Overlay.Gradient = Gradients.Glass;
cs.Appearance.FillStyle.BackgroundColor = color;
cs.LabelsAppearance.DataFormatString = format;
cs.TooltipsAppearance.DataFormatString = format;
if ((color.R * 2) + (color.G * 3) + color.B < 600)
cs.TooltipsAppearance.Color = Color.FromKnownColor(KnownColor.White);
barChart.PlotArea.Series.Add(cs);
}
Hi,
Is it possible to display the week numbers in the month view?
This would also be nice, since you could navigate to the week this way...
Regards
Andreas
Hi,
I have two issues with Kendo exporting PDF.
I am following the example from:
https://demos.telerik.com/kendo-ui/pdf-export/index
First one:
Here are two images attached showing the difference between WebPage text and PDF text. The text is vertical in my webpage but was changed to horizontal after being exported to PDF.
Thanks
Hello
I will try to be clear
i have a page with a Usercontrol (UC) in it
The UC have an AjaxManagerProxy and a grid with edit template
I have a page with a grid with editTemplate and inside the edit another grid
each grid is within a usercontrol (UC ) so each UC have its own ajaxManagerProxy
Hi Team,
I have Radgrid which has 2 Details Tables. On first details tables I have GridHyperLinkColumn, on click of which I open a Radwindow. In this Radwindow I have couple of fields whose data is relevant to First details tables. There is one asp.net button "Save" which should close the Radwindow and update/refresh the Data in the First Details tables.
Can you please help me to get this done.
Thanks.
A pair of RadTimePickers I have for selecting the beginning and end of a shift are displaying the timeview incorrectly after being enabled and having the starttime and endtime values set. They both show every slot from 12AM to 11:45PM, but starting with 12AM selecting a slot displays the value that SHOULD be seen, 8:30AM in this case, and continues for each subsequent slot in the same manner until the endtime slot, whose correct value is 5:15PM at the 8:45AM slot on the selection view. When the binding event is called a second time, the timeviews for both RTPs are correctly shown, going from 8:30AM to 5:15PM. HTML markup of the RTPs in question as follows, as well as the code-behind for the binding event.
//HTML//
<
telerik:RadTimePicker
ID
=
"tpStartTime"
runat
=
"server"
EnableTyping
=
"false"
TimeView-Columns
=
"4"
TimeView-Interval
=
"00:15:00"
Enabled
=
"false"
></
telerik:RadTimePicker
>
<
telerik:RadTimePicker
ID
=
"tpEndTime"
runat
=
"server"
EnableTyping
=
"false"
TimeView-Columns
=
"4"
TimeView-Interval
=
"00:15:00"
Enabled
=
"false"
></
telerik:RadTimePicker
>
//C#//
protected void dpOriginalDate_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
{
DateTime[] shift = getShift((DateTime)dpOriginalDate.SelectedDate);
tpStartTime.Enabled = tpEndTime.Enabled = true;
tpStartTime.TimeView.StartTime = shift[0].TimeOfDay;
tpStartTime.TimeView.EndTime = shift[1].TimeOfDay;
tpEndTime.TimeView.StartTime = shift[0].AddMinutes(15).TimeOfDay;
tpEndTime.TimeView.EndTime = shift[1].AddMinutes(15).TimeOfDay;
}
Page_Load contains Page.DataBind(); which appears to be the cause. Do I have to do without it or is there a workaround?