function chart_title(args) { 'use strict'; var svg = mg_get_svg_child_of(args.target); //remove the current title if it exists svg.select('.mg-header').remove(); if (args.target && args.title) { var chartTitle = svg.insert('text') .attr('class', 'mg-header') .attr('x', args.center_title_full_width ? args.width /2 : (args.width + args.left - args.right) / 2) .attr('y', args.title_y_position) .attr('text-anchor', 'middle') .attr('dy', '0.55em'); //show the title chartTitle.append('tspan') .attr('class', 'mg-chart-title') .text(args.title); //show and activate the description icon if we have a description if (args.show_tooltips && args.description && mg_jquery_exists()) { chartTitle.append('tspan') .attr('class', 'mg-chart-description') .attr('dx', '0.3em') .text('\uf059'); //now that the title is an svg text element, we'll have to trigger //mouseenter, mouseleave events manually for the popover to work properly var $chartTitle = $(chartTitle.node()); $chartTitle.popover({ html: true, animation: false, placement: 'top', content: args.description, container: args.target, trigger: 'manual', template: '