|
|
|
@ -50,7 +50,7 @@ this.getValueResultset = function () {
@@ -50,7 +50,7 @@ this.getValueResultset = function () {
|
|
|
|
|
{ |
|
|
|
|
if(rsMetaData[j].colcaption==defaultValue) |
|
|
|
|
isDefault=true; |
|
|
|
|
var o=new chartPropertyValue(rsMetaData[j].nr,rsMetaData[j].colcaption,rsMetaData[j].nr,isDefault); |
|
|
|
|
var o=new chartPropertyValue(rsMetaData[j].nr,rsMetaData[j].colcaption,rsMetaData[j].colname,isDefault); |
|
|
|
|
valueOptions[optionCounter]=o; |
|
|
|
|
optionCounter++; |
|
|
|
|
} |
|
|
|
@ -318,7 +318,7 @@ if(document.getElementById("viz_category_dim").value=="" ||
@@ -318,7 +318,7 @@ if(document.getElementById("viz_category_dim").value=="" ||
|
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
var data=[]; |
|
|
|
|
data=prepareData(); |
|
|
|
|
//data=prepareData();
|
|
|
|
|
|
|
|
|
|
var valueLabelWidth = getCommonChartProperty("valueLabelWidth");
|
|
|
|
|
var fontFamily=getCommonChartProperty("fontFamily");
|
|
|
|
@ -326,7 +326,7 @@ var gridLabelHeight = getCommonChartProperty("gridLabelHeight");
@@ -326,7 +326,7 @@ var gridLabelHeight = getCommonChartProperty("gridLabelHeight");
|
|
|
|
|
var gridChartOffset = getCommonChartProperty("gridChartOffset"); |
|
|
|
|
var chartWidth=getCommonChartProperty("chartWidth"); |
|
|
|
|
var fontSize=getCommonChartProperty("fontSize"); |
|
|
|
|
|
|
|
|
|
svg,data |
|
|
|
|
document.getElementById("chartDiv").innerHTML=""; //reset canvas
|
|
|
|
|
var svg = d3.select("#chartDiv").append("svg") |
|
|
|
|
.attr("width", chartWidth) //maxBarWidth + barLabelWidth + valueLabelWidth)
|
|
|
|
@ -339,15 +339,21 @@ var svg = d3.select("#chartDiv").append("svg")
@@ -339,15 +339,21 @@ var svg = d3.select("#chartDiv").append("svg")
|
|
|
|
|
|
|
|
|
|
switch (chartType) |
|
|
|
|
{ |
|
|
|
|
case "bar_x": |
|
|
|
|
case "sample": |
|
|
|
|
makeSample(); |
|
|
|
|
break; |
|
|
|
|
case "bar_x": |
|
|
|
|
makeBarX(); |
|
|
|
|
break; |
|
|
|
|
case "bar_x_alt": |
|
|
|
|
makeBarX(svg,data); |
|
|
|
|
break; |
|
|
|
|
case "bar_y": |
|
|
|
|
makeBarY(svg,data); |
|
|
|
|
makeBarY(); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case "line": |
|
|
|
|
makeLine(svg,data); |
|
|
|
|
makeLine(); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
alert("Please select a chart type"); |
|
|
|
@ -356,7 +362,7 @@ switch (chartType)
@@ -356,7 +362,7 @@ switch (chartType)
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function makeBarX(svg,data) |
|
|
|
|
function makeBarX_alt(svg,data) |
|
|
|
|
{ |
|
|
|
|
var barHeight = 18;
|
|
|
|
|
var barLabelWidth = 500;
|
|
|
|
@ -408,7 +414,7 @@ function makeBarX(svg,data)
@@ -408,7 +414,7 @@ function makeBarX(svg,data)
|
|
|
|
|
.text(d => d.name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function makeLine(svg,data) { |
|
|
|
|
function makeLine_alt(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"); |
|
|
|
@ -448,8 +454,122 @@ var options = {
@@ -448,8 +454,122 @@ var options = {
|
|
|
|
|
|
|
|
|
|
document.getElementById("chartDiv").appendChild(Plot.plot(options)); |
|
|
|
|
} |
|
|
|
|
function makeSample() |
|
|
|
|
{ |
|
|
|
|
var sales = [4]; |
|
|
|
|
sales = [ |
|
|
|
|
{units: 10, fruit: "fig"}, |
|
|
|
|
{units: 20, fruit: "date"}, |
|
|
|
|
{units: 40, fruit: "plum"}, |
|
|
|
|
{units: 30, fruit: "plum"} |
|
|
|
|
]; |
|
|
|
|
document.getElementById("chartDiv").appendChild(Plot.dot(sales,
|
|
|
|
|
{x: "units", y: "fruit"} |
|
|
|
|
).plot()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function getChartOptions(categoryDim,measureDim,marksArray,chartOrientationVertical) |
|
|
|
|
{ |
|
|
|
|
var options; |
|
|
|
|
var categoryDim=document.getElementById("viz_category_dim").value; |
|
|
|
|
var measureDim=document.getElementById("viz_measure_dim").value; |
|
|
|
|
var fontSizeDefault=getCommonChartProperty("fontSize"); |
|
|
|
|
var chartWidth=getCommonChartProperty("chartWidth"); |
|
|
|
|
var marginLeftDefault=chartWidth/5; //20% liner Rand
|
|
|
|
|
var marginBottomDefault=100; |
|
|
|
|
var categoryLabel=getColumnCaption(categoryDim); |
|
|
|
|
var measureLabel=getColumnCaption(measureDim); |
|
|
|
|
|
|
|
|
|
if(chartOrientationVertical) |
|
|
|
|
{ |
|
|
|
|
options={ |
|
|
|
|
marginLeft:marginLeftDefault, |
|
|
|
|
marginBottom:marginBottomDefault, |
|
|
|
|
fontSize:fontSizeDefault,
|
|
|
|
|
x: { |
|
|
|
|
tickRotate: -45, |
|
|
|
|
label:categoryLabel |
|
|
|
|
}, |
|
|
|
|
// set y axis options
|
|
|
|
|
y: { |
|
|
|
|
grid:true, |
|
|
|
|
label: measureLabel
|
|
|
|
|
}, |
|
|
|
|
marks: marksArray |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
options={ |
|
|
|
|
marginLeft:marginLeftDefault, |
|
|
|
|
marginBottom:marginBottomDefault,
|
|
|
|
|
fontSize:fontSizeDefault,
|
|
|
|
|
y: { |
|
|
|
|
label:categoryLabel |
|
|
|
|
}, |
|
|
|
|
x: { |
|
|
|
|
tickRotate: -45, |
|
|
|
|
grid:true, |
|
|
|
|
label: measureLabel
|
|
|
|
|
},
|
|
|
|
|
marks: marksArray |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
document.getElementById("chartOptions").innerHTML=JSON.stringify(options); |
|
|
|
|
|
|
|
|
|
function makeBarY(svg,data) { |
|
|
|
|
return options; |
|
|
|
|
} |
|
|
|
|
function makeBarX() { |
|
|
|
|
var categoryDim=document.getElementById("viz_category_dim").value; |
|
|
|
|
var measureDim=document.getElementById("viz_measure_dim").value; |
|
|
|
|
var marksArray=new Array(); |
|
|
|
|
marksArray[0]=Plot.barX(rs, |
|
|
|
|
{ |
|
|
|
|
x: measureDim,
|
|
|
|
|
y: categoryDim |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var options= getChartOptions(categoryDim,measureDim,marksArray,false); |
|
|
|
|
|
|
|
|
|
document.getElementById("chartDiv").appendChild(Plot.plot(options)); |
|
|
|
|
} |
|
|
|
|
function makeBarY() { |
|
|
|
|
var categoryDim=document.getElementById("viz_category_dim").value; |
|
|
|
|
var measureDim=document.getElementById("viz_measure_dim").value; |
|
|
|
|
var marksArray=new Array(); |
|
|
|
|
marksArray[0]=Plot.barY(rs, |
|
|
|
|
{ |
|
|
|
|
y: measureDim,
|
|
|
|
|
x: categoryDim |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var options= getChartOptions(categoryDim,measureDim,marksArray,true); |
|
|
|
|
|
|
|
|
|
document.getElementById("chartDiv").appendChild(Plot.plot(options)); |
|
|
|
|
} |
|
|
|
|
function makeLine() { |
|
|
|
|
var categoryDim=document.getElementById("viz_category_dim").value; |
|
|
|
|
var measureDim=document.getElementById("viz_measure_dim").value; |
|
|
|
|
var marksArray=new Array(); |
|
|
|
|
marksArray[0]=Plot.line(rs, |
|
|
|
|
{ |
|
|
|
|
y: measureDim,
|
|
|
|
|
x: categoryDim, |
|
|
|
|
curve: "linear" |
|
|
|
|
}); |
|
|
|
|
marksArray[1]=Plot.dot(rs, |
|
|
|
|
{ |
|
|
|
|
y: measureDim,
|
|
|
|
|
x: categoryDim |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var options= getChartOptions(categoryDim,measureDim,marksArray,true); |
|
|
|
|
|
|
|
|
|
document.getElementById("chartDiv").appendChild(Plot.plot(options)); |
|
|
|
|
} |
|
|
|
|
function makeBarY_alt(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"); |
|
|
|
@ -530,7 +650,11 @@ document.getElementById("chartSrcFields").style.visibility="visible";
@@ -530,7 +650,11 @@ document.getElementById("chartSrcFields").style.visibility="visible";
|
|
|
|
|
alert("Angezeigte Tabelle wurde in die Zwischenablage kopiert."); |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
function showOptionsCode() |
|
|
|
|
{ |
|
|
|
|
document.getElementById("chartOptionsFields").style.visibility="visible"; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
function copySrcCode(mydiv) |
|
|
|
|
{ |
|
|
|
|
var ergtabelle=document.getElementById(mydiv); |
|
|
|
@ -610,3 +734,14 @@ function switchWord1and2ff(theString)
@@ -610,3 +734,14 @@ function switchWord1and2ff(theString)
|
|
|
|
|
ret+=" "+ word1; |
|
|
|
|
return ret.trim(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getColumnCaption(columnName) |
|
|
|
|
{ |
|
|
|
|
let rsMetaDataLen = rsMetaData.length; |
|
|
|
|
var colCaption=columnName; |
|
|
|
|
for (let i = 0; i < rsMetaDataLen; i++) { |
|
|
|
|
if(rsMetaData[i].colname ==columnName) |
|
|
|
|
colCaption=rsMetaData[i].colcaption; |
|
|
|
|
}
|
|
|
|
|
return colCaption; |
|
|
|
|
} |
|
|
|
|