Jump to content
JChartFX Community
  • 0

Tooltip Content Template Issue.


Falkon

Question

We have a data set with multiple fields, where only one field is displayed in a pie chart, but all of them are displayed in the mouseover tooltip. Following samples from both http://community.jchartfx.com/topic/248-tooltip/ and http://community.jchartfx.com/topic/129-formatting-default-tooltip/, we created a content template for the tooltip. Everything shows up nicely, except the values in the tooltip, which display 'ABC' for Total Severity, Total Units, and Average Severity. Is the format for the content templates documented anywhere? What do we need to do to have this data displaying correctly?
 
var data = [{'Group':'Automobile', 'Type':'Total Loss', 'Amount':6000.00, 'Units':4, 'Average':1500.00}, {'Group':'Automobile', 'Type':'Repairable', 'Amount':40500.00, 'Units':27, 'Average':1500.00}];

var chart = new cfx.Chart();
chart.setGallery(cfx.Gallery.Pie);
chart.getGalleryAttributes().setExplodingMode(cfx.ExplodingMode.All);
chart.getView3D().setEnabled(true);

chart.getAxisY().getLabelsFormat().setFormat(cfx.AxisFormat.Currency);

var fields = chart.getDataSourceSettings().getFields();

var field = new cfx.FieldMap();
field.setName('Group');
field.setUsage(cfx.FieldUsage.ColumnHeading);
fields.add(field);

field = new cfx.FieldMap();
field.setName('Type');
field.setUsage(cfx.FieldUsage.RowHeading);
fields.add(field);

field = new cfx.FieldMap();
field.setName('Amount');
field.setUsage(cfx.FieldUsage.Value);
fields.add(field);

var contentTemplate =   '<DataTemplate>' +
                          '<DockPanel Orientation="Vertical">' +
                            '<DockPanel Orientation="Horizontal" Margin="3,0,3,0">' +
                              '<TextBlock Text="{Binding Path=SeriesT}" Margin="0,0,4,0"/>' +
                              '<TextBlock Text="{Binding Path=Value}" FontWeight="Bold" HorizontalAlignment="Right"/>' +
                            '</DockPanel>' +
                            '<DockPanel Orientation="Horizontal" Margin="3,0,3,0">' +
                              '<TextBlock Text="Total Severity: " Margin="0,0,4,0"/>' +
                              '<TextBlock Text="{Binding Path=DataAmount}" FontWeight="Bold" HorizontalAlignment="Right"/>' +
                            '</DockPanel>' +
                            '<DockPanel Orientation="Horizontal" Margin="3,0,3,0">' +
                              '<TextBlock Text="Total Units: " Margin="0,0,4,0"/>' +
                              '<TextBlock Text="{Binding Path=DataUnits}" FontWeight="Bold" HorizontalAlignment="Right"/>' +
                            '</DockPanel>' +
                            '<DockPanel Orientation="Horizontal" Margin="3,0,3,0">' +
                              '<TextBlock Text="Average Severity: " Margin="0,0,4,0"/>' +
                              '<TextBlock Text="{Binding Path=DataAverage}" FontWeight="Bold" HorizontalAlignment="Right"/>' +
                            '</DockPanel>' +
                          '</DockPanel>' +
                        '</DataTemplate>';
chart.getToolTips().setContentTemplate(contentTemplate);

var crosstab = new cfx.data.CrosstabDataProvider();
crosstab.setDataSource(data);
chart.setDataSource(crosstab);
chart.getAllSeries().getPointLabels().setVisible(true);

chart.create('divYtdChart2');

We are using version7.2.5289.19355 and have tested on Internet Explorer and Chrome.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...