使用XSLT条形图
你好,我一直在做柱状图。它接受xml代码并将其转换为svg条形图。我做了一个,数据以正常方式运行,“问题”沿着x轴运行,数据沿着y轴运行。我希望条形图显示沿y轴向上的问题,然后沿x轴显示数据。我不知道该怎么办使用XSLT条形图,xslt,svg,Xslt,Svg,你好,我一直在做柱状图。它接受xml代码并将其转换为svg条形图。我做了一个,数据以正常方式运行,“问题”沿着x轴运行,数据沿着y轴运行。我希望条形图显示沿y轴向上的问题,然后沿x轴显示数据。我不知道该怎么办 <?xml version="1.0"?> <?xml-stylesheet type='text/xsl' href='mytransformation.xslt' ?> <Survey> <Questions>
<?xml version="1.0"?>
<?xml-stylesheet type='text/xsl' href='mytransformation.xslt'
?>
<Survey>
<Questions>
<Number>1</Number>
<Question>Is there free circulation of air through and about the building in which you work?</Question>
<Comment>"One says where she is employed there are 100 women and small girls who work in a cellar without ventilation, and gas and electric lights burning all day."</Comment>
<Yes>468</Yes>
<No>249</No>
<Blank>93</Blank>
</Questions>
<Questions>
<Number>2</Number>
<Question>Are there offensive odors in the rooms occupied by employees; if so, from what causes?</Question>
<Comment>"Eighty-one from water-closets and seventy-three from various other causes."</Comment>
<Yes>342</Yes>
<No>233</No>
<Blank>235</Blank>
</Questions>
<Questions>
<Number>3</Number>
<Question>Are there facilities for washing?</Question>
<Comment>Fourteen answered yes, but if caught washing are fined.</Comment>
<Yes>460</Yes>
<No>124</No>
<Blank>226</Blank>
</Questions>
<Questions>
<Number>4</Number>
<Question>Are seats provided, as prescribed by law?</Question>
<Yes>320</Yes>
<No>192</No>
<Blank>298</Blank>
</Questions>
</Survey>
1.
你工作的大楼周围是否有空气自由流通?
“有人说,在她工作的地方,有100名妇女和小女孩在没有通风设备的地窖里工作,煤气灯和电灯整天亮着。”
468
249
93
2.
员工占用的房间是否有令人厌恶的气味;如果是,原因是什么?
“81人来自抽水马桶,73人来自各种其他原因。”
342
233
235
3.
有洗衣设施吗?
14人回答是的,但如果被发现洗衣服会被罚款。
460
124
226
4.
是否按照法律规定提供座位?
320
192
298
这是xslt代码
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="/">
<svg width="1000" height="1500">
<text id="title" x="500" y="50px" text-anchor="middle" style="fill:rgb(0,0,0);font-size:20;">SANITARY CONDITIONS OF WORKSHOPS AND FACTORIES</text>
<text id="50percentlabel" x="45" y="260" text-anchor="end">50%</text>
<text id="1000percentlabel" x="45" y="70" text-anchor="end">100%</text>
<text id="legendlabel" x="750" y="200">Legend: Survey Responses</text>
<rect height="20" width="50" x="750" y="220" fill="blue"/>
<text id="legend" x="810" y="235">Blank</text>
<rect height="20" width="50" x="750" y="250" fill="red"/>
<text id="legend" x="810" y="265">No</text>
<rect height="20" width="50" x="750" y="280" fill="black"/>
<text id="legend" x="810" y="295">Yes</text>
<line id="xaxis" x1="50" y1="450" x2="700" y2="450" style="stroke:rgb(0,0,0);"/>
<line id="yaxis" x1="50" y1="70" x2="50" y2="450" style="stroke:rgb(0,0,0);"/>
<xsl:for-each select="Survey/Questions">
<xsl:sort select="No" order="descending"/>
<xsl:if test="Yes">
<g>
<rect height="{(Blank div (Yes + No + Blank))*380}" width="25" x="{10+ (position()*50)}" y="70" fill="blue"/>
</g>
<g>
<rect height="{(No div (Yes + No + Blank))*380}" width="25" x="{10+ (position()*50)}" y="{70+(Blank div (Yes + No + Blank))*380}" fill="red"/>
</g>
<g>
<rect height="{(Yes div (Yes + No + Blank))*380}" width="25" x="{10+ (position()*50)}" y="{70+((Blank + No) div (Yes + No + Blank))*380}" fill="black"/>
</g>
<text id="Question" x="{15+ (position()*50)}" y="455" style="writing-mode: tb; glyph-orientation-vertical: 0;" >Q<xsl:number value="position()"/>: <xsl:value-of select="Question"/></text>
</xsl:if>
</xsl:for-each>
</svg>
</xsl:template>
</xsl:stylesheet>
车间和工厂的卫生条件
50%
100%
图例:调查答复
空白
不
对
问:160,;
你为什么要删除问题的上一版本?我认为没有人会回答你为什么要删除问题的上一版本?我认为没有人会回答