Browse Source

barY Test #3

makro_datasrc
Daniel Quathamer 3 years ago
parent
commit
372d3d4b6c
  1. 86
      superx/xml/js/d3/viz_functions.js
  2. 8
      superx/xml/viz_html_chart.xsl

86
superx/xml/js/d3/viz_functions.js vendored

@ -26,14 +26,14 @@ this.isDefault=isDefault; @@ -26,14 +26,14 @@ this.isDefault=isDefault;
}
function chartProperty(name,caption,isDynamic,isMeasure,isOptional,staticValues,defaultValue,optionalFunction)
function chartProperty(name,caption,isDynamic,isMeasure,isMandatory,staticValues,defaultValue,optionalFunction)
{
this.name=name;
this.caption=caption;
this.isDynamic=isDynamic;
this.isMeasure=isMeasure;
this.staticValues=staticValues;
this.isOptional=isOptional;
this.isMandatory=isMandatory;
this.defaultValue=defaultValue;
this.optionalFunction=optionalFunction;
this.getValueResultset = function () {
@ -83,8 +83,8 @@ function prepareChartProperties(chartType) @@ -83,8 +83,8 @@ function prepareChartProperties(chartType)
case "bar_x":
chartProperties=prepareBarXForm();
break;
case "rect_y":
chartProperties=prepareRectYForm();
case "bar_y":
chartProperties=prepareBarYForm();
break;
case "line":
chartProperties=prepareLineForm();
@ -102,22 +102,24 @@ function prepareBarXForm() @@ -102,22 +102,24 @@ function prepareBarXForm()
{
var chartProperties=[];
var propertyCounter=0;
var myProp= new chartProperty("viz_category_dim","Kategorie-Dimension",true,false,false,null,null,true);
var myProp= new chartProperty("viz_category_dim","Kategorie-Dimension",true,false,true,null,null,true);
chartProperties[0]=myProp;
var myProp= new chartProperty("viz_measure_dim","Maß",true,true,false,null,null,true);
var myProp= new chartProperty("viz_measure_dim","Maß",true,true,false,true,null,true);
chartProperties[1]=myProp;
return chartProperties;
}
function prepareRectYForm()
function prepareBarYForm()
{
var chartProperties=[];
var propertyCounter=0;
var myProp= new chartProperty("viz_category_dim","Kategorie-Dimension",true,false,false,null,null,true);
var myProp= new chartProperty("viz_category_dim","Kategorie-Dimension",true,false,true,null,null,true);
chartProperties[0]=myProp;
var myProp= new chartProperty("viz_measure_dim","Maß",true,true,false,null,null,true);
var myProp= new chartProperty("viz_series_dim","Serien-Dimension",true,false,false,null,null,true);
chartProperties[1]=myProp;
var myProp= new chartProperty("viz_measure_dim","Maß",true,true,true,null,null,true);
chartProperties[2]=myProp;
return chartProperties;
}
@ -126,9 +128,9 @@ function prepareLineForm() @@ -126,9 +128,9 @@ function prepareLineForm()
{
var chartProperties=[];
var propertyCounter=0;
var myProp= new chartProperty("viz_category_dim","X-Achse",true,false,false,null,null,true);
var myProp= new chartProperty("viz_category_dim","X-Achse",true,false,true,null,null,true);
chartProperties[0]=myProp;
var myProp= new chartProperty("viz_measure_dim","Y-Achse",true,true,false,null,null,true);
var myProp= new chartProperty("viz_measure_dim","Y-Achse",true,true,true,null,null,true);
chartProperties[1]=myProp;
return chartProperties;
@ -154,7 +156,7 @@ function renderForm(formDiv,chartProperties,myCommonChartProperties,dimFunctions @@ -154,7 +156,7 @@ function renderForm(formDiv,chartProperties,myCommonChartProperties,dimFunctions
const selElem = document.createElement("select");
selElem.name=chartProperties[k].name;
selElem.id=chartProperties[k].name;
fillSelectOptions(selElem,chartProperties[k].getValueResultset(),true);
fillSelectOptions(selElem,chartProperties[k].getValueResultset(),chartProperties[k].isMandatory);
tdSelElem.appendChild(selElem);
if(chartProperties[k].optionalFunction)
{
@ -340,8 +342,8 @@ switch (chartType) @@ -340,8 +342,8 @@ switch (chartType)
case "bar_x":
makeBarX(svg,data);
break;
case "rect_y":
makeRectY(svg,data);
case "bar_y":
makeBarY(svg,data);
break;
case "line":
@ -447,7 +449,7 @@ var options = { @@ -447,7 +449,7 @@ var options = {
document.getElementById("chartDiv").appendChild(Plot.plot(options));
}
function makeRectY(svg,data) {
function makeBarY(svg,data) {
var xLabel=rsMetaData[document.getElementById("viz_category_dim").value-1].colcaption;
var yLabel=rsMetaData[document.getElementById("viz_measure_dim").value-1].colcaption;
var fontSize=getCommonChartProperty("fontSize");
@ -466,63 +468,25 @@ var options = { @@ -466,63 +468,25 @@ var options = {
grid:true,
label: yLabel
},
sort: "nr",
marks: [
Plot.barY(data,{
x: "name",
y: "value"
})
]
}
document.getElementById("chartDiv").appendChild(Plot.plot(options));
}
function makeBarY(svg,data) {
var options = {
marginBottom:100,
x: {
tickRotate: -45,
ticks: 5,
tickSize: 5,
line: true,
tickPadding: 10,
labelAnchor: "left",
labelOffset: 0,
nice: true,
label: "My label"
},
// set y axis options
y: {
grid:true
},
sort: "nr",
// define the marks we will use, dots and a line
marks: [
//Plot.barY(data, Plot.groupX({x: "name", y: "value" }))
Plot.barY(
data,
Plot.barY(data,
Plot.groupX(
{ y: "sum" },
{y: "sum"},
{
x: "name",
y: "value",
sort: {x:"nr"},
filter: null
y: "value"
}
)
)
]
//Plot.dot(data, {x: "nr", y: "value",sort: { x: "nr" } })
};
)
]
}
document.getElementById("chartDiv").appendChild(Plot.plot(options));
}
function getCommonChartProperty(name)
{
var propertyValue="";

8
superx/xml/viz_html_chart.xsl

@ -115,8 +115,8 @@ padding:3px; @@ -115,8 +115,8 @@ padding:3px;
<!-- start Javascript-->
<xsl:template name="tableJavascript_viz">
<script language="Javascript" type="text/javascript" src="/superx/xml/js/d3/d3.min.js" />
<script language="Javascript" type="text/javascript" src="/superx/xml/js/d3/plot.js" />
<script language="Javascript" type="text/javascript" src="/superx/xml/js/viz/d3.min.js" />
<script language="Javascript" type="text/javascript" src="/superx/xml/js/viz/plot.js" />
<script><xsl:text>
//document.body.append(Plot.plot(options));
@ -155,7 +155,7 @@ commonChartProperties.push(newCommonChartProperty); @@ -155,7 +155,7 @@ commonChartProperties.push(newCommonChartProperty);
</xsl:text>
</script>
<script language="Javascript" type="text/javascript" src="/superx/xml/js/d3/viz_functions.js" />
<script language="Javascript" type="text/javascript" src="/superx/xml/js/viz/viz_functions.js" />
</xsl:template>
@ -1171,7 +1171,7 @@ rs[</xsl:text><xsl:value-of select="$rownr"/><xsl:text>][</xsl:text><xsl:value-o @@ -1171,7 +1171,7 @@ rs[</xsl:text><xsl:value-of select="$rownr"/><xsl:text>][</xsl:text><xsl:value-o
<td><select class="maskinputPflicht" id="viz_chart_type" NAME="viz_chart_type" tabindex="200" onChange="prepareChartProperties(this.value)" >
<option class="maskinput" value="">Bitte wählen</option>
<option class="maskinput" value="bar_x">Balkendiagramm horizontal (einfach)</option>
<option class="maskinput" value="rect_y">Balkendiagramm vertikal (einfach)</option>
<option class="maskinput" value="bar_y">Balkendiagramm vertikal (einfach)</option>
<option class="maskinput" value="line">Liniendiagramm vertikal (einfach)</option>
</select>
</td>

Loading…
Cancel
Save