We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

StackingAreaChart

Hello,
I'm trying to use the StackingAreaChart  by creating each StackingAreaSeries in code behind.  I'm using your sample as a guideline, but I cannot create the Datatemplate from the ChartAdornmentInfo LabelTemplate for each StackingAreaSeries . I need to convert the Xaml code to C#:

<chart:ChartAdornmentInfo.LabelTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Ellipse Stroke="#FF1BA1E2" StrokeThickness="3" Fill="White" Height="30" Width="30" HorizontalAlignment="Left" VerticalAlignment="Top"></Ellipse>
                                    <TextBlock Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding}" FontSize="12" FontFamily="Segoe UI" FontWeight="Bold" />
                                </Grid>
                            </DataTemplate>
                        </chart:ChartAdornmentInfo.LabelTemplate>


Any help will be very helpful.

George

12 Replies

RA Rachel A Syncfusion Team January 9, 2015 10:36 AM UTC

Hi George,

Thanks for using Syncfusion products.

We have prepared the sample by setting the adornment label template in code behind and please download the sample in the below location.

Sample: StackingSeries.zip

Please let us know if you need any further assistance.

Thanks,

Rachel. A




GS George Sterg January 9, 2015 01:37 PM UTC

Thank you works great! A need one more assistance:
I need to format the text of the tooltip.

The data showing the tooltip comes from a data template. the code for the YBindingPath is
YBindingPath = data.Columns[0].ColumnName.
 I have created a method  string getFormat(double number), totake the data from the datatable and return the format eg  format = "#,##0,.00K";

How can i use it for the tooltip?


RA Rachel A Syncfusion Team January 12, 2015 12:52 PM UTC

Hi George,

Thanks for your update.

We are able to specify format for Tooltip by using ToolTipTemplate property. In TooltipTemplate we can set string format for text block. We have prepared the sample based on your requirement and please download the sample in the below location.

Sample: Tooltip.zip

Please let us know if you have any queries.

Thanks,

Rachel. A




GS George Sterg January 12, 2015 01:27 PM UTC

Can you help me with this line?

binding.Path = new PropertyPath("YData");

What YData stand for?  I am using it in my StackingArea chart and also in a pie chart and it is not showing the tootip.


RA Rachel A Syncfusion Team January 13, 2015 12:06 PM UTC

Hi George,

Thanks for your response.

Query 1: What YData stand for in Tooltip template?

The Data Context of ToolTipTemplate is ChartSegment and YData is a property of ChartSegment. YData property refers to the y value position of cursor in the secondary axis. The tooltip can also display the x value position of cursor in the primary axis by binding the XData property. When you want to display the value from the underline model then that value can be accessed from the Item Property as like below code snippet.

Code Snippet[C#]

binding.Path = new PropertyPath("Item.Price");

Query 2: StackingArea chart and also in a pie chart and it is not showing the tooltip.

We have tried to reproduce the issue in stacking series and pie series, but we are unable to reproduce the issue. The Y-value for the chart series is displayed in both series.   We have prepared the below sample by using both series with tooltip.  If problem occurs, please revert us sample with replication procedure in order to reproduce the issue. It would be much appreciable.   

Sample: tooltip_modified.zip

Please let us know if you need any further assistance.

Thanks,

Rachel. A




GS George Sterg January 13, 2015 01:53 PM UTC

I think the problem not showing the tooltip is because my model is a Datatable (eg data). So in my case the XBinding and the YBinding is a column name a my datatable. I am using :
binding.Path =
new PropertyPath(data.Columns[0].ColumnName);
While debugging the TooltipTemplate has the following properties:
DataTemplateKey = null
DataType = null
Triggers count = 0
HasContent = false
IsSealed = false
Resources count = 0
Template = null

If this is the problem, how can I set the binding path to a column of a datatable?
Thank you



GS George Sterg January 13, 2015 04:36 PM UTC

Using your latest sample, it now works. Thank you for your assistance.


RA Rachel A Syncfusion Team January 14, 2015 12:32 PM UTC

Hi George,
Thanks for the update.

Please let us know if you require further assistance on this.

Thanks,

Rachel. A




GS George Sterg February 6, 2015 06:47 PM UTC

Using the code you send me, I would like to show in the tooltip both the XData and the YData.
The problem in this code :
binding.Path = new PropertyPath("XData"); 
is that is shows the number of each series (e.g. 0 for the first series and so on). How can I show the value from the X axis?

Thanks,
George


RA Rachel A Syncfusion Team February 9, 2015 09:40 AM UTC

Hi George,

Thank you for the update.

In CategoryAxis, Tooltip XData property will return the index position of data point (i.e., each segment). In order to display the x axis values of each segment in ToolTip, we need to bind the Item property as shown in the below code snippet.
Code Snippet:
binding1.Path = new PropertyPath("Item.ProdId");
We have modified the sample based on your requirement and please download the sample in the below location.

Sample: custom_tooltip.zip

Note: For NumericAxis, we can directly use the XData property and for DateTimeAxis or TimeSpanAxis we can get x axis value by converting double to DateTime.

Please refer the documentation link for more information

Link:  http://help.syncfusion.com/ug/wpf/default.htm#!documents/customizetooltip.htm
Please let us know if you require further assistance on this.

Thanks,

Rachel. A




GS George Sterg February 9, 2015 01:12 PM UTC

In my case I use a datatable as source. I tried using the column name but with no result. How can I achieve this?


RA Rachel A Syncfusion Team February 10, 2015 06:39 AM UTC

Hi George,

Thank you for your response.

When use Data Table ItemsSource, the corresponding segment Data Row objects (underline objects) will be stored in Item property. So we can get x axis value of each segment through the Data Row’s ItemArray property as shown in the below code snippet.

Code Snippet:
binding1.Path = new PropertyPath("Item.ItemArray[1]");

We have modified the sample based on this requirement and please download the sample in the below location.

Sample: datatable_tooltip.zip

Please let us know if you have any queries.

Thanks,
Rachel. A



Loader.
Live Chat Icon For mobile
Up arrow icon