From fbd3190415d9da8b3579086b590ad80dc26fcc8e Mon Sep 17 00:00:00 2001 From: Daniel Quathamer Date: Thu, 27 Oct 2022 08:29:23 +0200 Subject: [PATCH] Layout Assistent, Area Chart #5 --- superx/xml/js/viz/viz_functions.js | 64 +++++++++++++++++++++++++++++- superx/xml/viz_html_chart.xsl | 36 ++++++++++++++--- 2 files changed, 94 insertions(+), 6 deletions(-) diff --git a/superx/xml/js/viz/viz_functions.js b/superx/xml/js/viz/viz_functions.js index 30cf277..c2a6fb2 100644 --- a/superx/xml/js/viz/viz_functions.js +++ b/superx/xml/js/viz/viz_functions.js @@ -150,6 +150,9 @@ function prepareChartProperties(chartType) case "bar_y": chartProperties=prepareBarYForm(); break; + case "area_y": + chartProperties=prepareBarYForm(); + break; case "line": chartProperties=prepareLineForm(); break; @@ -224,6 +227,10 @@ if(formDivElem.style.display=="none") var dimFunctions=[]; var myFunction= new dimFunction(0,"Wort 1 ans Ende","switchWord1and2ff",false); dimFunctions[0]=myFunction; + var myFunction= new dimFunction(1,"Nur Wort 1","justWord1",false); + dimFunctions[1]=myFunction; + var myFunction= new dimFunction(2,"Abkürzen (20)","abbreviate",false); + dimFunctions[2]=myFunction; selectionProperties=prepareSelectionForm(); for(var k=0;k < selectionProperties.length;k++) @@ -639,7 +646,9 @@ case "bar_x": case "bar_y": makeBarY(selectionRs); break; - + case "area_y": + makeAreaY(selectionRs); + break; case "line": makeLine(selectionRs); break; @@ -848,6 +857,20 @@ function makeBarY(selectionRs) { var options= getChartOptions(categoryDim,measureDim,marksArray,true); + document.getElementById("chartDiv").appendChild(Plot.plot(options)); + } +function makeAreaY(selectionRs) { + var categoryDim=document.getElementById("viz_dimension1").value; + var measureDim=document.getElementById("viz_measure1").value; + var marksArray=new Array(); + marksArray[0]=Plot.areaY(selectionRs, + { + y: measureDim, + x: categoryDim + }); + + var options= getChartOptions(categoryDim,measureDim,marksArray,true); + document.getElementById("chartDiv").appendChild(Plot.plot(options)); } function makeLine(selectionRs) { @@ -1014,6 +1037,12 @@ function applyFunction(theValue,theFunction) case "switchWord1and2ff": var ret=switchWord1and2ff(theValue); break; + case "justWord1": + var ret=justWord1(theValue); + break; + case "abbreviate": + var ret=abbreviate(theValue,20); + break; default: var ret=theValue; break; @@ -1042,6 +1071,39 @@ function switchWord1and2ff(theString) return ret.trim(); } +function justWord1(theString) +{ + //nur erstes Wort, zum Sortieren + var word1End=-1; + var i=0; + var endFound=false; + do{ + var myChar=theString.substr(i,1); + if(myChar=="|" || myChar==" "|| myChar=="-") + { + endFound=true; + word1End=i; + } + else + i++; + } + while (endFound==false && i<=theString.length); + if(word1End==-1) + word1End=theString.length; + return theString.substr(0,word1End); +} + +function abbreviate(theString,theMaxLength) +{ + //nur erste x Zeichen + if(theString.length > theMaxLength) + { + var theCut = theString.substr(0,theMaxLength-3)+"..."; + return theCut; + } + else return theString.trim(); +} + function getColumnCaption(columnName) { let rsMetaDataLen = rsMetaData.length; diff --git a/superx/xml/viz_html_chart.xsl b/superx/xml/viz_html_chart.xsl index aaa1605..3806a35 100644 --- a/superx/xml/viz_html_chart.xsl +++ b/superx/xml/viz_html_chart.xsl @@ -1537,19 +1537,31 @@ rs.push(new dataRow(
- + + onClick="selectionResultPreview('selectionResultPreviewTable');"> +
--> +
+ + + + + +
@@ -1566,11 +1578,13 @@ rs.push(new dataRow( + +
@@ -1590,22 +1604,34 @@ rs.push(new dataRow(
-
+ +
+-->
- +
+ + + + + +