Hi There,
I am trying turn of smart label on particular chart point by right click and making its visibility to be collapsed.I tried to find some work around on data point ,legend connectors but I could not figure any kind of solution.
We have requirement where a user wants to turn of smart lable on particular point by right click and turn off from context menu. Any kind of sample project will really help us.
ThankYou,
I am adding two line series chart with common x-axis (which is the date range selected) which is already sorted. Now the issue is that if any of the series don't have data for a particular date than those dates automatically gets shifted to the end.
Suppose if we have date range(x-axis) configured from 1st Nov 2013 to 30th Nov 2013 and for one series data is not there 21 to 29 Nov but the other series have data, than these dates gets shifted to the end. Please see the attached image "WrongDateInMiddle.png" for better understanding of the issue.
What I want is that if there is no data for particular dates than chart should show gaps instead of shifting those dates to the end. Something like the functionality available in "Telerik Ajaz HTML Charts" and shown in the attached image "ajax_htmlchart_various_data_types.png"
Code:
I am adding two line series and binding them to two different data sources. After that running a foreach loop to go through each series and make the chart. See code below, here chartSetting.Series contains both the series for whom line chart is to be created.
var count = 0;
foreach
( var setting
in
chartSetting.Series )
{
UpdateChartArea( chartSetting, setting, count );
UpdateSeriesMapping( chartSetting, setting );
count++;
}
private
void
UpdateChartArea( CustomChartSetting chartSetting, CustomChartSeriesSetting setting,
int
count )
{
//Axis
var axisY =
new
AxisY();
axisY.DefaultLabelFormat = setting.YAxisDisplayFormat;
axisY.Title = setting.YAxisLabel;
if
( count == 0 )
{
var axisX =
new
AxisX();
axisX.DefaultLabelFormat = chartSetting.XAxisDisplayFormat;
axisX.Title = chartSetting.XAxisLabel;
radChart.DefaultView.ChartArea.AxisY = axisY;
radChart.DefaultView.ChartArea.AxisX = axisX;
}
else
if
( setting.UseAdditionalYAxis )
{
radChart.DefaultView.ChartArea.AdditionalYAxes.Add( axisY );
}
//CustomGridLine
if
( setting.UpperLimit !=
null
)
{
var upperLimit =
new
CustomGridLine();
upperLimit.YIntercept = setting.UpperLimit.Value;
radChart.DefaultView.ChartArea.Annotations.Add( upperLimit );
}
if
( setting.LowerLimit !=
null
)
{
var lowerLimit =
new
CustomGridLine();
lowerLimit.YIntercept = setting.LowerLimit.Value;
radChart.DefaultView.ChartArea.Annotations.Add( lowerLimit );
}
}
private
void
UpdateSeriesMapping( CustomChartSetting chartSetting, CustomChartSeriesSetting setting )
{
if
( chartSetting.XAxisValue !=
null
&& setting.YAxisValue !=
null
)
{
var seriesMapping =
new
SeriesMapping();
seriesMapping.ItemsSource = setting.Details;
seriesMapping.LegendLabel = setting.YAxisLabel;
//Rotate lables if there are too many record
radChart.DefaultView.ChartArea.AxisX.LabelRotationAngle = setting.Details !=
null
? ( setting.Details.Count > 20 ? -90 : setting.Details.Count > 10 ? -50 : 0 ) : 0;
seriesMapping.SeriesDefinition = setting.ChartType == ConfigurableChartType.Bar ?
new
BarSeriesDefinition() : ( setting.ChartType == ConfigurableChartType.Line ?
new
LineSeriesDefinition() : seriesMapping.SeriesDefinition =
new
PieSeriesDefinition() );
ItemMapping itemMapping =
new
ItemMapping();
itemMapping.DataPointMember = setting.ChartType == ConfigurableChartType.Pie ? DataPointMember.LegendLabel : DataPointMember.XCategory;
itemMapping.FieldName = chartSetting.XAxisValue;
seriesMapping.ItemMappings.Add( itemMapping );
itemMapping =
new
ItemMapping();
itemMapping.DataPointMember = DataPointMember.YValue;
seriesMapping.ItemMappings.Add( itemMapping );
radChart.SeriesMappings.Add( seriesMapping );
this
.radChart.CreateItemStyleDelegate = BuildCustomItemStyle;
}
}
I have a chart where-in I have to display a graph and tooltip which shows "round-off" values.
sb.AppendFormat(string.Format("#XCAT : {0} #DATAITEM.OriginalValue", displayCurrency));
This only shows original value on the tooltip. I want round-off value of the decimal.
Please help.
Thanks in advance
Hi There,
Is there any way where we can find if chart is some data or not. I know it will display "No Data" template when there is no data I want know a property which triggers it. Why I need so because we have chart and some other UI element like grid... which should syn other UI element when there is some data on chart.
Basically I am looking for some property like "IsChartHasSomeData" . Please help me to know this I mean how can we do this.?
Hi,
I have a top N style bar chart with 2 series, inputs and ouputs. X axis is company names, and y axis is an aggregate of the amount. This is much like the documentation at http://docs.telerik.com/devtools/wpf/controls/radchart/features/grouping/and-aggregation and the second last picture where you show the sum of all apples and bananas per year and region. For ​2008 I have inputs, and for 2009 I have outputs, for regions I have companies and for quantity I have amount. I have the correct data displayed, but I want to sort the data so that, in your example, the region with the highest 2008 figure comes first, so Europe(331) is on the top, then North America (322), then Asia (316). In other words the sorting is defined by one of the series. How can I do that?
Thanks
Hello,
If we zoom to an area where there is no data point, the entire chart is removed and replaced with the no data control.
Is there a way to change that behavior, so that no data will never be shown if originally(zoom=1.0) we had some data?
Thank you,
In our project we are using the RadCartesianChart and we want to (dynamically) display some vertical lines.
For this we have code like the following in place:
var collection = GetSomeFilteredData();
foreach (var dateTime in collection)
{
var cartesianGridLineAnnotation = new CartesianGridLineAnnotation
{
ZIndex = -100,
Value = dateTime,
Stroke = new SolidColorBrush(Colors.Black),
StrokeThickness = 1,
Axis = this.HorizontalAxis
};
this.ChartControl.Annotations.Add(cartesianGridLineAnnotation);
}
When debugging I can verify that the data is loaded and added to the ChartControl.Annotations collection. But it doesn't display.
Other than that, everything works fine (e.g. display of static horizontal lines as declared in xaml, which are also in the Annotations collection).
Any idea what I am missing here?
Also, is there a "better" way of achieving our goal? I would like it if I could just bind a collection in the ViewModel to a property of the chart.
Thanks in advance for any help.