mirror of https://github.com/apache/lucene.git
SOLR-518: Changed luke.xsl to use divs w/css for generating histograms instead of SVG ... also made some other small cleanup changes to luke.xsl
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@659287 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3b9df5ffc6
commit
cd3b0f0fd7
|
@ -455,6 +455,9 @@ Other Changes
|
||||||
|
|
||||||
13. Upgrade to Lucene 2.3.2
|
13. Upgrade to Lucene 2.3.2
|
||||||
|
|
||||||
|
14. SOLR-518: Changed luke.xsl to use div/css for generating histograms instead
|
||||||
|
of SVG (Thomas Peuss via hossman)
|
||||||
|
|
||||||
Build
|
Build
|
||||||
1. SOLR-411. Changed the names of the Solr JARs to use the defacto standard JAR names based on
|
1. SOLR-411. Changed the names of the Solr JARs to use the defacto standard JAR names based on
|
||||||
project-name-version.jar. This yields, for example:
|
project-name-version.jar. This yields, for example:
|
||||||
|
|
|
@ -20,12 +20,15 @@
|
||||||
<!--
|
<!--
|
||||||
Display the luke request handler with graphs
|
Display the luke request handler with graphs
|
||||||
-->
|
-->
|
||||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
<xsl:stylesheet
|
||||||
xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" version="1.0">
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
version="1.0"
|
||||||
|
>
|
||||||
<xsl:output
|
<xsl:output
|
||||||
method="xml"
|
method="html"
|
||||||
encoding="UTF-8"
|
encoding="UTF-8"
|
||||||
media-type="text/xml; charset=UTF-8"
|
media-type="text/html; charset=UTF-8"
|
||||||
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
||||||
/>
|
/>
|
||||||
|
@ -35,12 +38,14 @@
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
|
<link rel="stylesheet" type="text/css" href="solr-admin.css"/>
|
||||||
|
<link rel="icon" href="favicon.ico" type="image/ico"/>
|
||||||
|
<link rel="shortcut icon" href="favicon.ico" type="image/ico"/>
|
||||||
<title>
|
<title>
|
||||||
<xsl:value-of select="$title"/>
|
<xsl:value-of select="$title"/>
|
||||||
</title>
|
</title>
|
||||||
<!-- <xsl:call-template name="svg_ie_workaround"/> -->
|
|
||||||
<xsl:call-template name="css"/>
|
<xsl:call-template name="css"/>
|
||||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>
|
<h1>
|
||||||
|
@ -56,8 +61,6 @@
|
||||||
<xsl:if test="response/lst[@name='fields']">
|
<xsl:if test="response/lst[@name='fields']">
|
||||||
<li>
|
<li>
|
||||||
<a href="#fields">Field Statistics</a>
|
<a href="#fields">Field Statistics</a>
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<ul>
|
<ul>
|
||||||
<xsl:for-each select="response/lst[@name='fields']/lst">
|
<xsl:for-each select="response/lst[@name='fields']/lst">
|
||||||
<li>
|
<li>
|
||||||
|
@ -77,11 +80,11 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<xsl:if test="response/lst[@name='index']">
|
<xsl:if test="response/lst[@name='index']">
|
||||||
<h2><a name="index"/>Index statistics</h2>
|
<h2><a name="index"/>Index Statistics</h2>
|
||||||
<xsl:apply-templates select="response/lst[@name='index']"/>
|
<xsl:apply-templates select="response/lst[@name='index']"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="response/lst[@name='fields']">
|
<xsl:if test="response/lst[@name='fields']">
|
||||||
<h2><a name="fields"/>Field statistics</h2>
|
<h2><a name="fields"/>Field Statistics</h2>
|
||||||
<xsl:apply-templates select="response/lst[@name='fields']"/>
|
<xsl:apply-templates select="response/lst[@name='fields']"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="response/lst[@name='doc']">
|
<xsl:if test="response/lst[@name='doc']">
|
||||||
|
@ -125,7 +128,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when
|
<xsl:when
|
||||||
test="@name='histogram' and not(system-property('xsl:vendor')='Microsoft')">
|
test="@name='histogram'">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<xsl:call-template name="histogram"/>
|
<xsl:call-template name="histogram"/>
|
||||||
|
@ -144,67 +147,61 @@
|
||||||
<xsl:template name="histogram">
|
<xsl:template name="histogram">
|
||||||
<div class="doc">
|
<div class="doc">
|
||||||
<xsl:call-template name="barchart">
|
<xsl:call-template name="barchart">
|
||||||
<xsl:with-param name="xoffset">5</xsl:with-param>
|
<xsl:with-param name="max_bar_width">50</xsl:with-param>
|
||||||
<xsl:with-param name="yoffset">5</xsl:with-param>
|
|
||||||
<xsl:with-param name="iwidth">800</xsl:with-param>
|
<xsl:with-param name="iwidth">800</xsl:with-param>
|
||||||
<xsl:with-param name="iheight">600</xsl:with-param>
|
<xsl:with-param name="iheight">160</xsl:with-param>
|
||||||
<xsl:with-param name="fill">blue</xsl:with-param>
|
<xsl:with-param name="fill">blue</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="barchart">
|
<xsl:template name="barchart">
|
||||||
<xsl:param name="xoffset"/>
|
<xsl:param name="max_bar_width"/>
|
||||||
<xsl:param name="yoffset"/>
|
|
||||||
<xsl:param name="iwidth"/>
|
<xsl:param name="iwidth"/>
|
||||||
<xsl:param name="iheight"/>
|
<xsl:param name="iheight"/>
|
||||||
<xsl:param name="fill"/>
|
<xsl:param name="fill"/>
|
||||||
<svg:svg viewBox="0 0 {$iwidth} {$iheight}">
|
<xsl:variable name="max">
|
||||||
<xsl:if test="system-property('xsl:vendor')='Opera' or system-property('xsl:vendor')='libxslt'">
|
<xsl:for-each select="int">
|
||||||
<xsl:attribute name="width"><xsl:value-of select="$iwidth"/></xsl:attribute>
|
<xsl:sort data-type="number" order="descending"/>
|
||||||
<xsl:attribute name="height"><xsl:value-of select="$iwidth"/></xsl:attribute>
|
<xsl:if test="position()=1">
|
||||||
</xsl:if>
|
<xsl:value-of select="."/>
|
||||||
<xsl:variable name="x" select="$xoffset + 5"/>
|
</xsl:if>
|
||||||
<xsl:variable name="y" select="$yoffset + 5"/>
|
</xsl:for-each>
|
||||||
<xsl:variable name="width" select="$iwidth - 10"/>
|
</xsl:variable>
|
||||||
<xsl:variable name="height" select="$iheight - 30"/>
|
<xsl:variable name="bars">
|
||||||
<xsl:variable name="max">
|
<xsl:value-of select="count(int)"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="bar_width">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$max_bar_width < ($iwidth div $bars)">
|
||||||
|
<xsl:value-of select="$max_bar_width"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$iwidth div $bars"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<table class="histogram">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
<xsl:for-each select="int">
|
<xsl:for-each select="int">
|
||||||
<xsl:sort data-type="number" order="descending"/>
|
<td>
|
||||||
<xsl:if test="position()=1">
|
<xsl:value-of select="."/>
|
||||||
<xsl:value-of select="."/>
|
<div class="histogram">
|
||||||
</xsl:if>
|
<xsl:attribute name="style">background-color: <xsl:value-of select="$fill"/>; width: <xsl:value-of select="$bar_width"/>px; height: <xsl:value-of select="($iheight*number(.)) div $max"/>px;</xsl:attribute>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:variable>
|
</tr>
|
||||||
<xsl:variable name="yRatio" select="$height div $max"/>
|
<tr>
|
||||||
<xsl:variable name="xRatio" select="$width div count(int)"/>
|
|
||||||
<svg:g>
|
|
||||||
<xsl:for-each select="int">
|
<xsl:for-each select="int">
|
||||||
<svg:rect stroke="none" x="{$x + (position() - 1) * $xRatio + 0.1 * $xRatio}"
|
<td>
|
||||||
y="{($y + $height) - number(.) * $yRatio}" width="{0.8 * $xRatio}"
|
<xsl:value-of select="@name"/>
|
||||||
height="{number(.) * $yRatio}" fill="{$fill}"/>
|
</td>
|
||||||
<xsl:variable name="yboost">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when
|
|
||||||
test="($y + $height) - number(.) * $yRatio +40 > $iheight"
|
|
||||||
>-25</xsl:when>
|
|
||||||
<xsl:otherwise>0</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
<svg:text
|
|
||||||
x="{$x + (position() - 1) * $xRatio + 0.1 * $xRatio + (($xRatio * 0.8) div 2)}"
|
|
||||||
y="{($y + $height) - number(.) * $yRatio +20 + number($yboost)}"
|
|
||||||
text-anchor="middle" style="fill: red; font-size: 8px;">
|
|
||||||
<xsl:value-of select="."/>
|
|
||||||
</svg:text>
|
|
||||||
<svg:text
|
|
||||||
x="{$x + (position() - 1) * $xRatio + 0.1 * $xRatio + (($xRatio * 0.8) div 2)}"
|
|
||||||
y="{$y + $height + 20}" text-anchor="middle" style="fill: black; font-size: 8px;">
|
|
||||||
<xsl:value-of select="@name"/>
|
|
||||||
</svg:text>
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</svg:g>
|
</tr>
|
||||||
</svg:svg>
|
</tbody>
|
||||||
|
</table>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="keyvalue">
|
<xsl:template name="keyvalue">
|
||||||
|
@ -328,23 +325,13 @@
|
||||||
<xsl:template name="css">
|
<xsl:template name="css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
body { font-family: "Lucida Grande", sans-serif }
|
|
||||||
td.name {font-style: italic; font-size:80%; }
|
td.name {font-style: italic; font-size:80%; }
|
||||||
th { font-style: italic; font-size: 80%; background-color: lightgrey; }
|
|
||||||
td { vertical-align: top; }
|
|
||||||
ul { margin: 0px; margin-left: 1em; padding: 0px; }
|
|
||||||
table { width: 100%; border-collapse: collapse; }
|
|
||||||
.note { font-size:80%; }
|
|
||||||
.doc { margin: 0.5em; border: solid grey 1px; }
|
.doc { margin: 0.5em; border: solid grey 1px; }
|
||||||
.exp { display: none; font-family: monospace; white-space: pre; }
|
.exp { display: none; font-family: monospace; white-space: pre; }
|
||||||
|
div.histogram { background: none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;}
|
||||||
|
table.histogram { width: auto; vertical-align: bottom; }
|
||||||
|
table.histogram td, table.histogram th { text-align: center; vertical-align: bottom; border-bottom: 1px solid #ff9933; width: auto; }
|
||||||
]]>
|
]]>
|
||||||
</style>
|
</style>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
<xsl:template name="svg_ie_workaround">
|
|
||||||
<xsl:if test="system-property('xsl:vendor')='Microsoft'">
|
|
||||||
<object id="AdobeSVG" classid="clsid:78156a80-c6a1-4bbf-8e6a-3cd390eeb4e2"/>
|
|
||||||
<xsl:processing-instruction name="import">namespace="svg"
|
|
||||||
implementation="#AdobeSVG"</xsl:processing-instruction>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
Loading…
Reference in New Issue