You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
3.7 KiB
67 lines
3.7 KiB
<div class="bg-white p-4 border-radius-8">
|
|
|
|
<% heading_gutter = 30 %>
|
|
<% footer_gutter = 50 %>
|
|
<% measure_row_height = 40 %>
|
|
<% graph_height = measure_graph_row_presenters.length * measure_row_height + heading_gutter + footer_gutter %>
|
|
<% graph_background_height = graph_height - footer_gutter %>
|
|
<% measure_row_bar_height = 20 %>
|
|
<% label_padding_right = 24 %>
|
|
|
|
<svg width="100%" height=<%= graph_height %> xmlns="http://www.w3.org/2000/svg">
|
|
|
|
<filter id="inset-shadow" x="-50%" y="-50%" width="200%" height="200%">
|
|
<feComponentTransfer in=SourceAlpha>
|
|
<feFuncA type="table" tableValues="1 0"/>
|
|
</feComponentTransfer>
|
|
<feGaussianBlur stdDeviation="4"/>
|
|
<feOffset dx="0" dy="5" result="offsetblur"/>
|
|
<feFlood flood-color="rgb(0, 0, 0)" result="color"/>
|
|
<feComposite in2="offsetblur" operator="in"/>
|
|
<feComposite in2="SourceAlpha" operator="in"/>
|
|
<feMerge>
|
|
<feMergeNode in="SourceGraphic"/>
|
|
<feMergeNode/>
|
|
</feMerge>
|
|
</filter>
|
|
|
|
<svg id="graph-background" x="25%" y="0" width="75%" height=<%= graph_background_height %>>
|
|
<g id="scale-headings">
|
|
<text class="graph-header" x="8.335%" y=<%= heading_gutter / 2 %> text-anchor="middle" dominant-baseline="middle">Warning</text>
|
|
<text class="graph-header" x="25%" y=<%= heading_gutter / 2 %> text-anchor="middle" dominant-baseline="middle">Watch</text>
|
|
<text class="graph-header" x="41.665%" y=<%= heading_gutter / 2 %> text-anchor="middle" dominant-baseline="middle">Growth</text>
|
|
<text class="graph-header" x="62.5%" y=<%= heading_gutter / 2 %> text-anchor="middle" dominant-baseline="middle">Approval</text>
|
|
<text class="graph-header" x="87.5%" y=<%= heading_gutter / 2 %> text-anchor="middle" dominant-baseline="middle">Ideal</text>
|
|
</g>
|
|
|
|
<g id="scale-background" transform="translate(0, <%= heading_gutter %>)">
|
|
<rect id="warning-zone" class="fill-warning" x="0" y="0" width="16.67%" height="100%" opacity="0.2" filter="url(#inset-shadow)"/>
|
|
<rect id="watch-zone" class="fill-watch" x="16.67%" y="0" width="16.67%" height="100%" opacity="0.2" filter="url(#inset-shadow)"/>
|
|
<rect id="growth-zone" class="fill-growth" x="33.33%" y="0" width="16.67%" height="100%" opacity="0.2" filter="url(#inset-shadow)"/>
|
|
<rect id="approval-zone" class="fill-approval" x="50%" y="0" width="25%" height="100%" opacity="0.2" filter="url(#inset-shadow)"/>
|
|
<rect id="ideal-zone" class="fill-ideal" x="75%" y="0" width="25%" height="100%" opacity="0.2" filter="url(#inset-shadow)"/>
|
|
|
|
<rect id="key-benchmark" x="50%" transform="translate(-1, 0)" y="0" width="2" height="100%" fill="black"/>
|
|
</g>
|
|
</svg>
|
|
|
|
<g id="measure-rows">
|
|
<svg id="measure-row-labels" x="0" y=<%= heading_gutter %>>
|
|
<%= measure_graph_row_presenters.each_with_index do |presenter, index| %>
|
|
<text class="font-cabin weight-600" x="25%" dx=<%= -1 * label_padding_right %> y=<%= index * measure_row_height + measure_row_height / 2 %> text-anchor="end" dominant-baseline="middle"><%= presenter.measure_name %></text>
|
|
<% end %>
|
|
</svg>
|
|
|
|
<svg id="measure-row-bars" x="25%" y=<%= heading_gutter %> width="75%">
|
|
<%= measure_graph_row_presenters.each_with_index do |presenter, index| %>
|
|
<rect class="measure-row-bar <%= presenter.bar_color %>" x="<%= presenter.x_offset %>" y="<%= index * measure_row_height + (measure_row_height - measure_row_bar_height) / 2 %>" width="<%= presenter.bar_width %>" height=<%= measure_row_bar_height %> />
|
|
<% end %>
|
|
</svg>
|
|
</g>
|
|
|
|
<g id="legend">
|
|
<text class="graph-footer" x="58.33%" y="<%= graph_background_height + (footer_gutter / 2) %>">Benchmark</text>
|
|
</g>
|
|
</svg>
|
|
</div>
|