Posted 9 September 2024, 3:52 am EST
Can You please provide Example for Gantt Chart?
How to use DataTemplate for Series Tooltip template. The Datatemplate for Chart Tooltip soes shw the template but unable to bind the datapoint dataItem
Forums Home / ComponentOne / WPF Edition
Posted by: david on 9 September 2024, 3:52 am EST
Posted 9 September 2024, 3:52 am EST
Can You please provide Example for Gantt Chart?
How to use DataTemplate for Series Tooltip template. The Datatemplate for Chart Tooltip soes shw the template but unable to bind the datapoint dataItem
Posted 10 September 2024, 2:33 pm EST
Hi David,
We are currently working on this requirement. We will update you once we are done with the sample.
Thanks & Regards,
Aastha
Posted 11 September 2024, 3:04 pm EST
Hi David,
We are discussing this requirement with the developers. [Internal Tracking ID: C1XAML-36896]
We will update you once we hear back from them.
Thanks & Regards,
Aastha
Posted 23 September 2024, 12:13 am EST
Hi David,
We have created a sample application that shows how to implement Gantt Chart using C1Flexchart WPF. Kindly refer to the attached sample for the same. [GanttChartDemo.zip]
For the tooltip, a special property has been added to the Task class and used it in tooltip.
Hope this helps!
Thanks & Regards,
Aastha
Posted 23 September 2024, 1:16 am EST
Hi Aastha
Thanks for the Gantt Chart example.
The second question regarding the tooltip remains un-answered. I would like to assign a DataTemplate for individual series tooltip. When I tried to assign a DataTemplate for charts tooltip, unable to bind data.
Basically series tooltip property gets string only, cannot assign DataTemplate.
Thanks and Regards
David
Posted 25 September 2024, 12:38 am EST
Hi David,
We are sorry for the inconvenience. Currently, you can only set the string template for the Series tooltip.
However, we would appreciate it if you could share the details of how you would like the tooltip to appear (including the content of the DataTemplate), so we can discuss with our developers whether your request is feasible.
Thanks & Regards,
Aastha
Posted 25 September 2024, 1:04 am EST
Here is my Datatemplate for the tooltip.
<DataTemplate x:Key="PercType"> <Grid c1:PlotElement.LabelAlignment="MiddleCenter" FlowDirection="{Binding ConverterParameter=FlowDirection, Converter={StaticResource TooltipObjectDataConverter}}" DataContext="{Binding DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ToolTip}}}"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <TextBlock Grid.Column="0" Margin="2,0" Grid.Row="0" Text="{Binding Series.Label}" FontWeight="Bold" /> <!--<TextBlock Grid.Column="1" Margin="2,0" Grid.Row="0" Text="{Binding Value, ConverterParameter=n2, Converter={x:Static c1:Converters.Format}}" />--> <TextBlock Grid.Column="1" Margin="2,0" Grid.Row="0" Text="{Binding ConverterParameter=Value, Converter={StaticResource TooltipObjectDataConverter}}" /> <TextBlock Grid.Column="0" Margin="2,0" Grid.Row="1" Text="{Binding ConverterParameter=Percentile_Label, Converter={StaticResource TooltipObjectDataConverter}}" FontWeight="Bold"/> <TextBlock Grid.Column="1" Margin="2,0" Grid.Row="1" Text="{Binding ConverterParameter=Percentile, Converter={StaticResource TooltipObjectDataConverter}}"/> <TextBlock Grid.Column="0" Margin="2,0" Grid.Row="2" Text="{Binding ConverterParameter=X_Label, Converter={StaticResource TooltipObjectDataConverter}}" FontWeight="Bold"/> <TextBlock Grid.Column="1" Margin="2,0" Grid.Row="2" Text="{Binding ConverterParameter=X_Value, Converter={StaticResource TooltipObjectDataConverter}}"/> <TextBlock Grid.Column="0" Margin="2,0" Grid.Row="3" Text="{Binding ConverterParameter=Date_Label, Converter={StaticResource TooltipObjectDataConverter}}" FontWeight="Bold"/> <TextBlock Grid.Column="1" Margin="2,0" Grid.Row="3" Text="{Binding ConverterParameter=Date, Converter={StaticResource TooltipObjectDataConverter}}"/> </Grid> </DataTemplate>
Posted 25 September 2024, 5:02 am EST
Hi David,
Thanks for providing the data template structure. We are currently discussing it with the developers.
We will update you once we hear back from them.
Thanks & Regards,
Aastha
Posted 3 November 2024, 3:24 am EST
Hi Aastha
any Update on the issue?
Regards
David
Posted 4 November 2024, 12:49 am EST
Hi David,
You have to use multi-binding and its converter to get the current task from chart’s data source and point index (transferred in tooltip content).
We kindly request you refer to the attached sample for full implementation. GanttChartDemoTooltipTemplate.zip
Thanks & Regards,
Aastha
Posted 4 November 2024, 4:55 am EST
Hi Aastha
Cannot open the zipped files, it gives error while extracting. Please resend the zip.
Thanks
David
Posted 4 November 2024, 5:46 pm EST
Hi David,
We have attached the zip file here again: GanttChartDemoTooltipTemplate.zip
In case you still face issue in extracting this file, we kindly request you try some other extraction software like 7-zip, as we did not face this problem at our end.
Thanks & Regards,
Aastha
Posted 5 November 2024, 3:47 am EST
Hi Aastha
That zip file seems to be corrupt, do not resend it. Make a new one please.
Thanks and Regards
David
Posted 6 November 2024, 7:58 am EST
Hi David,
Here we have made the zip file again: GanttChartDemo_upd.zip
We are also sharing with you a temporary link from where you can download the project folder: https://www.dropbox.com/scl/fo/mvfiwy6yey4giwmhaf8lv/AIXZFXjtHOE8FOila90yrvE?rlkey=g0swh5zodnlp1byyee8tu906k&st=m7rtpyks&dl=0
Hope this helps you!
Thanks & Regards,
Aastha
Posted 25 November 2024, 6:46 am EST
HI Astha
In flexchart we are missing PointLabelTemplate for series, Can you please provide some example how we can assign datatemplate to the series?
Thanks and Regards
David
Posted 26 November 2024, 8:11 am EST
Hi David,
Unfortunately, there is no way to set a DataTemplate for the point labels. To customize the labels, you can handle the LabelRendering event and use the IRenderEngine provided in the RenderDataLabelEventArgs to custom draw the labels. Here is a small code snippet for reference:
private void Flexchart_LabelRendering(object? sender, RenderDataLabelEventArgs e)
{
e.Cancel = true;
var text = (e.Item as Task).Name;
e.Engine.SetFill(Colors.Red);
e.Engine.DrawString(text, new _Point(e.Point.X, e.Point.Y));
}
Best Regards,
Kartik