Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kainagel committed Nov 21, 2024
1 parent 9b3846e commit 8bb7790
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 134 deletions.
23 changes: 23 additions & 0 deletions src/main/java/org/tub/vsp/bvwp/data/type/Einstufung.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,27 @@ public static Einstufung getFromString( String description ) {
throw new RuntimeException( "unknown Einstufung=" + description );
// return UNDEFINED;
}
public static double getSize( String prio ){
final double factor = 8.;
final double offset = 6.;
double size = 0.;
switch( valueOf( prio ) ){
case VBE -> {
size = 3. * factor + offset;
}
case VB -> {
size = 2. * factor + offset;
}
case WBP -> {
size = 1. * factor + offset;
}
case WB -> {
size = offset;
}
default -> {
size = offset;
}
}
return size;
}
}
39 changes: 24 additions & 15 deletions src/main/java/org/tub/vsp/bvwp/plot/MultiPlotUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ public static String pageTop(){
+ "<h1>Part A</h1>" + System.lineSeparator() );

for( int ii = 0 ; ii < 99 ; ii++ ){
result.append( "<div id='plot" ).append( ii ).append( "'>" ).append( System.lineSeparator() );
result.append( "<div id='plot" + ii + "'>\n" );
}
result.append( "<h1>2. Zwischenbericht</h1>" ).append( System.lineSeparator() );
result.append( "<h1>2. Zwischenbericht</h1>\n" ).append( System.lineSeparator() );
for( int ii = 1001 ; ii < 1100 ; ii++ ){
result.append( "<div id='plot" ).append( ii ).append( "'>" ).append( System.lineSeparator() );
result.append( "<div id='plot" ).append( ii ).append( "'>\n" ).append( System.lineSeparator() );
}
result.append( "<h1>Part B</h1>" ).append( System.lineSeparator() );
result.append( "<h1>Part B</h1>\n" ).append( System.lineSeparator() );
for( int ii = 0 ; ii < 26 ; ii++ ){
final char c = (char) (ii + 65); // generate A, B, ... to be backwards compatible with what we had so far. kai, mar'24
result.append( "<div id='plot" ).append( c ).append( "'>" ).append( System.lineSeparator() );
result.append( "<div id='plot" ).append( c ).append( "'>\n" ).append( System.lineSeparator() );
}
return result.toString();
}

public static final String pageBottom = "</body>" + System.lineSeparator() + "</html>";

public static String createPageV2( List<Pair<String, Figure>> figures ) {
public static String createPageV2( List<Pair<String, List<Figure>>> figures ) {
StringBuilder result = new StringBuilder( "<html>" + System.lineSeparator()
+ "<head>" + System.lineSeparator()
+ " <title>Multi-plot test</title>" + System.lineSeparator()
Expand All @@ -54,21 +54,30 @@ public static String createPageV2( List<Pair<String, Figure>> figures ) {

// append the html that references each individual plot:
{
for ( int ii=0; ii<figures.size(); ii++ ) {
final Pair<String, Figure> entry = figures.get( ii );
result.append( entry.getFirst() );
if ( entry.getValue()!= null ){
result.append( "<div id='plot" ).append( ii ).append( "'>" );
int cnt = 0;
for( Pair<String, List<Figure>> entry : figures ){
result.append( entry.getFirst() ).append( System.lineSeparator() );
result.append( "<ul>" ).append( System.lineSeparator() );
if( entry.getValue() != null ){
for( Figure figure : entry.getValue() ){
result.append( "<li id='plot" ).append( cnt ).append( "' style='display:inline-block' />" ).append( System.lineSeparator() );
cnt++;
}
}
result.append( "</ul>" ).append( System.lineSeparator() );
}
}

// append the figures themselves:
{
for ( int ii=0; ii<figures.size(); ii++ ) {
final Figure figure = figures.get( ii ).getSecond();
if ( figure != null ){
result.append( figure.asJavascript( "plot" + ii ) ).append( System.lineSeparator() );
int cnt = 0;
for( Pair<String, List<Figure>> stringListPair : figures ){
List<Figure> list = stringListPair.getSecond();
if( list != null ){
for( Figure figure : list ){
result.append( figure.asJavascript( "plot" + cnt ) ).append( System.lineSeparator() );
cnt++;
}
}
}
}
Expand Down
13 changes: 2 additions & 11 deletions src/main/java/org/tub/vsp/bvwp/users/kn/Figures1KN.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,9 @@ class Figures1KN{
// ===========================
{
DoubleColumn column = DoubleColumn.create( EINSTUFUNG_AS_NUMBER );
final double factor = 8.;
final double offset = 6.;
for( String prio : table.stringColumn( EINSTUFUNG ) ){
switch( Einstufung.valueOf( prio ) ){
case VBE -> column.append( 3. * factor + offset );
case VB -> column.append( 2. * factor + offset );
case WBP -> column.append( 1. * factor + offset );
case WB -> column.append( offset );
// case UNDEFINED -> column.append( 2. );
default -> // throw new IllegalStateException( "Unexpected value: " + prio );
column.append( offset );
}
final double size = Einstufung.getSize( prio );
column.append( size );
}
table.addColumns( column );
}
Expand Down
Loading

0 comments on commit 8bb7790

Please sign in to comment.