Skip to content

Commit

Permalink
Thermodynamic diagram: Added windprofile axis in default class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivo Sonderegger committed Jul 30, 2021
1 parent 08e0300 commit 53766c3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/meteoJS/ThermodynamicDiagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import WindspeedProfile from './thermodynamicDiagram/WindspeedProfile.js';
import Hodograph from './thermodynamicDiagram/Hodograph.js';
import { xAxis as xAxisClass } from './thermodynamicDiagram/axes/xAxis.js';
import { yAxis as yAxisClass } from './thermodynamicDiagram/axes/yAxis.js';
import { WindspeedProfileAxis as WindspeedProfileAxisClass } from './thermodynamicDiagram/axes/WindspeedProfileAxis.js';

/**
* Options for the coordinate system.
Expand Down Expand Up @@ -38,6 +39,8 @@ import { yAxis as yAxisClass } from './thermodynamicDiagram/axes/yAxis.js';
* [windbarbs] - Options for the windbarbs profile.
* @param {module:meteoJS/thermodynamicDiagram/windspeedProfile~options}
* [windprofile] - Options for the windspeed profile.
* @param {module:meteoJS/thermodynamicDiagram/axes/windspeedProfileAxis~options}
* [windspeedProfileAxis] - Options for the windspeed profile axis.
* @param {module:meteoJS/thermodynamicDiagram/hodograph~options} [hodograph]
* Options for the hodograph container.
* @param {module:meteoJS/thermodynamicDiagram/axes/xAxis~options} [xAxis]
Expand Down Expand Up @@ -66,6 +69,7 @@ export class ThermodynamicDiagram extends ThermodynamicDiagramPluggable {
diagram = {},
windbarbsProfile = {},
windspeedProfile = {},
windspeedProfileAxis = {},
hodograph = {},
xAxis = {},
yAxis = {}
Expand All @@ -79,6 +83,7 @@ export class ThermodynamicDiagram extends ThermodynamicDiagramPluggable {
diagram = normalizePlotAreaOptions(diagram);
windbarbsProfile = normalizePlotAreaOptions(windbarbsProfile);
windspeedProfile = normalizePlotAreaOptions(windspeedProfile);
windspeedProfileAxis = normalizePlotAreaOptions(windspeedProfileAxis);
hodograph = normalizePlotAreaOptions(hodograph);
xAxis = normalizePlotAreaOptions(xAxis);
yAxis = normalizePlotAreaOptions(yAxis);
Expand Down Expand Up @@ -157,6 +162,15 @@ export class ThermodynamicDiagram extends ThermodynamicDiagramPluggable {
xAxis.y = diagram.y + diagram.height;
if (xAxis.height === undefined)
xAxis.height = defaultPadding;

if (windspeedProfileAxis.width === undefined)
windspeedProfileAxis.width = windspeedProfile.width;
if (windspeedProfileAxis.height === undefined)
windspeedProfileAxis.height = defaultPadding;
if (windspeedProfileAxis.x === undefined)
windspeedProfileAxis.x = windspeedProfile.x;
if (windspeedProfileAxis.y === undefined)
windspeedProfileAxis.y = windspeedProfile.y + windspeedProfile.height;

// Defintionen zum Hodograph
if (hodograph.x === undefined)
Expand All @@ -181,7 +195,16 @@ export class ThermodynamicDiagram extends ThermodynamicDiagramPluggable {
this.appendPlotArea(this.windbarbsProfile);

this.windspeedProfile = new WindspeedProfile(windspeedProfile);
this.windspeedProfile.on('prebuild:background', ({ node }) => {
node
.rect(this.windspeedProfile.width, this.windspeedProfile.height)
.fill({ color: 'white' })
.stroke({ color: 'black', width: 1 });
});
this.appendPlotArea(this.windspeedProfile);

this.windspeedProfileAxis = new WindspeedProfileAxisClass(windspeedProfileAxis);
this.appendPlotArea(this.windspeedProfileAxis);

this.hodograph = new Hodograph(hodograph);
this.hodograph.on('prebuild:background', ({ node }) => {
Expand Down

0 comments on commit 53766c3

Please sign in to comment.