<!-- BEGIN [% component.name %] -->
    [% BLOCK chart_url;
        flags = {}; # INCLUDE dumper.tt dump = anonymise_chart;
        flags.USE_FILE_SESSIONS = use_file_sessions; # eg called via cron;
        flags.ANONYMISE_CHART   = anonymise_chart; # set in anonymise_report()
		# need to pass session ID manually if called 'in memory' ie PDF gen:
        # flags.CGISESSID = c.session.id IF url_session_id_required; # using cookies in make_pdf()
        # INCLUDE dumper.tt dump = flags;
        # INCLUDE dumper.tt dump = format_info;
        # INCLUDE dumper.tt dump = section_name.lower;
        USE img_url = url(app_url _ '/chart/' _ chart_type _ '/' _ data.id, flags);
    %]
      <div style="margin: 10px 20px"><img src="[% img_url %]" /></div>
	[% END %]

    [% # INCLUDE dumper.tt dump = format_info %]
    [% # INCLUDE dumper.tt dump = section_name %]

    [% # draw graphs/charts if required (special_formatting.yml):
        IF format_info; # INCLUDE dumper.tt dump = format_info;
            display_section = format_info.display_section;
            chart_type      = format_info.chart_type;

            IF chart_type.match('imatinib') AND NOT patient.nhs_number;
                chart_type = 0; # disable chart if no nhs number
            END;

            IF chart_type; # INCLUDE dumper.tt dump = chart_type;
                IF section_name; # only supplied by report/results section
                    INCLUDE chart_url IF display_section == section_name.lower;
                ELSE; # will be body of request
                    INCLUDE chart_url;
                END;
            END;
        END;
    %]
<!-- END [% component.name %] -->
