Skip to content

Commit

Permalink
dsv
Browse files Browse the repository at this point in the history
  • Loading branch information
Saffo, David committed Nov 2, 2023
1 parent 3845df0 commit 45213aa
Show file tree
Hide file tree
Showing 12 changed files with 36,974 additions and 11 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added anu-examples/.DS_Store
Binary file not shown.
Binary file added anu-examples/examples/.DS_Store
Binary file not shown.
6 changes: 4 additions & 2 deletions anu-examples/examples/Geographic/Texture_Globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import { Vector3, Scene, Color4, HemisphericLight, ArcRotateCamera, Vector2 } from '@babylonjs/core';
import * as anu from '@jpmorganchase/anu';
import {csv} from 'd3';
import data from '../../data/airports.csv'


export function textureGlobe(babylonEngine){
const scene = new Scene(babylonEngine);
Expand All @@ -17,7 +19,7 @@ export function textureGlobe(babylonEngine){


//Use D3 to read in our csv data
csv("../anu/data/airports.csv", (d) => d).then((data) => {


let globe = anu.createTextureGlobe('globe', {resolution: new Vector2(5000,2500), diameter:10}, scene)

Expand All @@ -31,6 +33,6 @@ export function textureGlobe(babylonEngine){
.scaling(new Vector3(0.1,0.1,0.1))
.position((d) => globe.lonLatToVector3([d.longitude, d.latitude]))

});

return scene;
}
5 changes: 3 additions & 2 deletions anu-examples/examples/Geographic/Texture_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import { Vector3, Scene, Color4, HemisphericLight, ArcRotateCamera } from '@babylonjs/core';
import * as anu from '@jpmorganchase/anu';
import {csv} from 'd3';
import data from '../../data/airports.csv'


export function textureMap(babylonEngine){
const scene = new Scene(babylonEngine);
Expand All @@ -15,7 +17,6 @@ export function textureMap(babylonEngine){
camera.position = new Vector3(0, 100, -20)

//Use D3 to read in our csv data
csv("../anu/data/airports.csv", (d) => d).then((data) => {
//Our data has over 3000 points so we will use mesh instancing for better performance
//To do this we must first create a mesh to be our root and register a buffer for color
let rootSphere = anu.create('sphere', 'sphere', scene, {diameter: 0.2})
Expand Down Expand Up @@ -71,6 +72,6 @@ export function textureMap(babylonEngine){
.positionZ((d) => scaleLat([d.longitude, d.latitude]))
.prop("isVisible", (d,m,i) => bounds(m))
});
});

return scene;
}
6 changes: 3 additions & 3 deletions anu-examples/examples/LineCharts/linechart2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import {extent, csv, timeYear, timeParse, timeFormat, scaleTime, scaleLinear, scaleSequential, interpolateBlues} from "d3";
import * as anu from '@jpmorganchase/anu';
import {Mesh, TransformNode, Color3, Scene, Vector3, HemisphericLight, ArcRotateCamera} from "@babylonjs/core";
import data from '../../data/yield-curve.csv'


export function linechart2D(babylonEngine) {
const scene = new Scene(babylonEngine);
Expand All @@ -23,7 +25,6 @@ export function linechart2D(babylonEngine) {



csv("../anu/data/yield-curve.csv", (d) => d).then((data) => {
let years = ["1 Yr", "2 Yr", "3 Yr", "5 Yr", "7 Yr", "10 Yr"];

var parseTime = timeParse("%m/%d/%Y");
Expand Down Expand Up @@ -69,7 +70,6 @@ export function linechart2D(babylonEngine) {
}
});

});


return scene;
}
5 changes: 3 additions & 2 deletions anu-examples/examples/LineCharts/linechart3D.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import * as d3 from "d3";
import * as anu from '@jpmorganchase/anu';
import {VertexBuffer, Mesh, TransformNode, Color3, Scene, Vector3, HemisphericLight, ArcRotateCamera} from "@babylonjs/core";
import data from '../../data/yield-curve.csv'


export function linechart3D(babylonEngine) {
const scene = new Scene(babylonEngine);
Expand All @@ -21,7 +23,6 @@ export function linechart3D(babylonEngine) {

let CoT = new TransformNode("cot");

d3.csv("/anu/public/data/yield-curve.csv", (d) => d).then((data) => {
let years = ["1 Yr", "2 Yr", "3 Yr", "5 Yr", "7 Yr", "10 Yr"];

var parseTime = d3.timeParse("%m/%d/%Y");
Expand Down Expand Up @@ -97,7 +98,7 @@ export function linechart3D(babylonEngine) {
.select("#cot", scene)
.bind("lines", { points: myPaths2[0]})
.attr("color", new Color3(0, 0, 0));
});


return scene;
}
122 changes: 122 additions & 0 deletions anu-examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions anu-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"preview": "vite preview"
},
"devDependencies": {
"@rollup/plugin-dsv": "^3.0.4",
"vite": "^3.2.7"
},
"dependencies": {
Expand Down
6 changes: 5 additions & 1 deletion anu-examples/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'vite'
import dsv from '@rollup/plugin-dsv'

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -15,5 +16,8 @@ export default defineConfig({
},
rollupOptions: {
external: ["@babylonjs/core"],
}
},
plugins: [
dsv(),
]
})
Loading

0 comments on commit 45213aa

Please sign in to comment.