|
|
|
@ -83,6 +83,9 @@ function prepareChartProperties(chartType)
@@ -83,6 +83,9 @@ function prepareChartProperties(chartType)
|
|
|
|
|
case "bar_x": |
|
|
|
|
chartProperties=prepareBarXForm(); |
|
|
|
|
break; |
|
|
|
|
case "rect_y": |
|
|
|
|
chartProperties=prepareRectYForm(); |
|
|
|
|
break; |
|
|
|
|
case "line": |
|
|
|
|
chartProperties=prepareLineForm(); |
|
|
|
|
break; |
|
|
|
@ -107,6 +110,18 @@ function prepareBarXForm()
@@ -107,6 +110,18 @@ function prepareBarXForm()
|
|
|
|
|
return chartProperties; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function prepareRectYForm() |
|
|
|
|
{ |
|
|
|
|
var chartProperties=[]; |
|
|
|
|
var propertyCounter=0; |
|
|
|
|
var myProp= new chartProperty("viz_category_dim","Kategorie-Dimension",true,false,false,null,null,true); |
|
|
|
|
chartProperties[0]=myProp; |
|
|
|
|
var myProp= new chartProperty("viz_measure_dim","Maß",true,true,false,null,null,true); |
|
|
|
|
chartProperties[1]=myProp; |
|
|
|
|
|
|
|
|
|
return chartProperties; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function prepareLineForm() |
|
|
|
|
{ |
|
|
|
|
var chartProperties=[]; |
|
|
|
@ -324,8 +339,11 @@ switch (chartType)
@@ -324,8 +339,11 @@ switch (chartType)
|
|
|
|
|
{ |
|
|
|
|
case "bar_x": |
|
|
|
|
makeBarX(svg,data); |
|
|
|
|
//makeBarY(svg,data);
|
|
|
|
|
break; |
|
|
|
|
case "rect_y": |
|
|
|
|
makeRectY(svg,data); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case "line": |
|
|
|
|
makeLine(svg,data); |
|
|
|
|
break; |
|
|
|
@ -429,6 +447,37 @@ var options = {
@@ -429,6 +447,37 @@ var options = {
|
|
|
|
|
document.getElementById("chartDiv").appendChild(Plot.plot(options)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function makeRectY(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"); |
|
|
|
|
var maxLenName=d3.max(data, d => d.name.length); |
|
|
|
|
var maxLenNamePx=maxLenName*fontSize/1.5; |
|
|
|
|
var marginLeftPx=xLabel.length*fontSize; |
|
|
|
|
|
|
|
|
|
var options = { |
|
|
|
|
marginBottom:maxLenNamePx, |
|
|
|
|
marginLeft:marginLeftPx, |
|
|
|
|
x: { |
|
|
|
|
tickRotate: -45 |
|
|
|
|
}, |
|
|
|
|
// set y axis options
|
|
|
|
|
y: { |
|
|
|
|
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, |
|
|
|
|