Skip to content
Snippets Groups Projects
Commit d2ec864e authored by Peter Morstein's avatar Peter Morstein
Browse files

get data from api

parent 988b0e1e
No related branches found
No related tags found
No related merge requests found
...@@ -181,24 +181,6 @@ export default class Legend extends Vue{ ...@@ -181,24 +181,6 @@ export default class Legend extends Vue{
mounted(){ mounted(){
console.log("Legend mounted"); console.log("Legend mounted");
let series: TemperatureSeries[] = new Array<TemperatureSeries>();
series.push({date: 2005, value: 3});
series.push({date: 2006, value: 5});
series.push({date: 2007, value: 7});
series.push({date: 2008, value: 4});
series.push({date: 2009, value: 9});
series.push({date: 2010, value: 3});
series.push({date: 2011, value: 5});
series.push({date: 2012, value: 7});
series.push({date: 2013, value: 4});
series.push({date: 2014, value: 9});
/* let tChart1 = new TemperatureLegendChart();
tChart1.render("legendTemperature1", series);
let tChart2 = new TemperatureLegendChart();
tChart2.render("legendTemperature2", series); */
axios.get("http://127.0.0.1:42000/annualMean", { axios.get("http://127.0.0.1:42000/annualMean", {
headers: {'Access-Control-Allow-Origin': '*'} headers: {'Access-Control-Allow-Origin': '*'}
}).then(resp => { }).then(resp => {
......
...@@ -28,7 +28,7 @@ export default class StationLayer{ ...@@ -28,7 +28,7 @@ export default class StationLayer{
this.layer = new VectorLayer({ this.layer = new VectorLayer({
className: StationLayer.layerName, className: StationLayer.layerName,
source: new VectorSource({ source: new VectorSource({
url: "http://localhost/germanStation.geojson", url: "http://localhost:42000/",
format: new GeoJSON(), format: new GeoJSON(),
}), }),
style: (feature)=>{return this.stationStyle(feature)} style: (feature)=>{return this.stationStyle(feature)}
...@@ -69,7 +69,7 @@ export default class StationLayer{ ...@@ -69,7 +69,7 @@ export default class StationLayer{
let fontSize = 15 let fontSize = 15
let label = ''; let label = '';
if(this.mapProperties.getZoomLevel()>=8){ if(this.mapProperties.getZoomLevel()>=8){
label += feature.get("id"); label += feature.get("station_id");
} }
let iconColor = "none"; let iconColor = "none";
......
...@@ -6,14 +6,14 @@ export default class TemperatureLegendChart{ ...@@ -6,14 +6,14 @@ export default class TemperatureLegendChart{
private d3svg: any; private d3svg: any;
private margin = {top: 10, right: 30, bottom: 30, left: 30} private margin = {top: 10, right: 30, bottom: 30, left: 20}
private width = 0; private width = 0;
private height = 0; private height = 0;
public render(chartID: string, tSeries: TemperatureSeries[]):void{ public render(chartID: string, tSeries: TemperatureSeries[]):void{
this.width = 350 - this.margin.left - this.margin.right; this.width = 360 - this.margin.left - this.margin.right;
this.height = 70 - this.margin.top - this.margin.bottom; this.height = 80 - this.margin.top - this.margin.bottom;
this.d3svg = d3.select("#"+chartID) this.d3svg = d3.select("#"+chartID)
.append("svg") .append("svg")
...@@ -28,7 +28,7 @@ export default class TemperatureLegendChart{ ...@@ -28,7 +28,7 @@ export default class TemperatureLegendChart{
this.d3svg.append("g") this.d3svg.append("g")
.attr("transform", "translate(0," + this.height + ")") .attr("transform", "translate(0," + this.height + ")")
.call(d3.axisBottom(xScale).ticks(10).tickFormat(d3.format("d")); .call(d3.axisBottom(xScale).ticks(5).tickFormat(d3.format("d"));
let yScale = d3.scaleLinear() let yScale = d3.scaleLinear()
.domain([d3.min(tSeries, function(d){return d.value}), d3.max(tSeries, function(d){return d.value})]) .domain([d3.min(tSeries, function(d){return d.value}), d3.max(tSeries, function(d){return d.value})])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment