<div class="view-column col-1">

    <script type="text/javascript" src="{{ deploy_context | safe }}/static/js/d3.v3.js"></script>
    <script type="text/javascript" src="{{ deploy_context | safe }}/static/js/tvbviz.js?{{ currentVersionJS }}"></script>
    <script type="text/javascript" src="{{ deploy_context | safe }}/static/js/matrix_view.js?{{ currentVersionJS }}"></script>

    <link rel="stylesheet" href="{{ deploy_context | safe }}/static/style/subsection_svg.css?{{ currentVersionJS }}" type="text/css"/>

    <h4>{{ title }}</h4>
    <div id="svg-viewer"></div>

    {% if has_complex_numbers %}
        <div class="matrix-info">
            <p>Matrix <span><b>has complex numbers!</b></span> Here we only display the real part.</p>
        </div>
    {% endif %}

        {% if has_infinite_values %}
        <div class="matrix-info">
            <p>Matrix <span><b>has infinite values!</b></span> Positive infinite values were replaced with a very big number
                and negative infinite values were replaced with a very small number before displaying the matrix.</p>
        </div>
    {% endif %}

    {% if show_slice_info %}

        <div class="slice-info">
            <p>Matrix shape <span class="npy-slice">{{ original_matrix_shape }}</span></p>

            {% if is_default_slice %}
                {% if not given_slice %}
                    You have not entered a slice.
                {% else %}
                    The given slice <span class="npy-slice">{{ given_slice }}</span> has not produced a 2d view of the data.
                {% endif %}

                The above view was produced by the default slice <span class="npy-slice">{{ slice_used }}</span>.
            {% else %}
                <span>
                    Current slice <span class="npy-slice">{{ slice_used }}</span>.
                </span>
            {% endif %}

        </div>
    {% endif %}

    <script type="text/javascript">

        function initMatrixViewer(width, height) {
            $("#main").addClass("colscheme-1");
            matrix_view_init_svg('{{ matrix_data }}', '{{ matrix_shape }}', "{{ viewer_title }}", '{{ matrix_labels | safe }}',
                ["Place mouse over matrix elements to inspect their values",
                    "Drag in colorbar to select and show entries in a range of values"], width, height);
        }

        // For the burst Preview part
        function launchViewer(width, height) {
            initMatrixViewer(width, height);
        }
        $(document).ready(function () {
            if (! {{ 'true' if isPreview is defined else 'false' }}) {
                initMatrixViewer();
            }
        });
    </script>

</div>
