Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions app/app.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace $.$$ {

const data = $mol_wire_sync( this.$ ).$mol_blob_json( file )

const plot_raw = $mol_wire_sync( this.$ ).$mpds_visavis_plot_raw_from_json( data, file.name )
const plot_raw = $mol_wire_sync( this.$ ).$mpds_visavis_plot_raw_from_jsons( [ data ], file.name )

this.plot_opened_id( this.history_add( plot_raw ) )
}
Expand Down Expand Up @@ -45,11 +45,13 @@ namespace $.$$ {
return this.$.$mol_state_local.value( `${this}.history_plot_ids()` , next ) ?? []
}


@ $mol_mem_key
plot_raw(id: string, next?: $mpds_visavis_plot_raw | null) {

if ( this.json_request_hash() ) {
const json = $mpds_visavis_plot.fetch_plot_json( this.json_request_hash() )
return $mpds_visavis_plot_raw_from_json( json, this.json_request_hash()! )
return $mpds_visavis_plot_raw_from_jsons( [ json ], this.json_request_hash()! )
}

if ( this.menu_section() == 'examples' ) {
Expand All @@ -63,10 +65,10 @@ namespace $.$$ {
@ $mol_mem_key
plot_raw_example(id: string) {
const data: $mpds_visavis_plot_raw['data_default'] | null = this.$.$mol_state_local.value( `${this}.plot_raw_example('${id}')` )
if ( data ) return new $mpds_visavis_plot_raw( data )
if ( data?.jsons ) return new $mpds_visavis_plot_raw( data )

const json = $mol_fetch.json( this.examples()[ id ] )
const plot_raw = $mpds_visavis_plot_raw_from_json( json, id )
const plot_raw = $mpds_visavis_plot_raw_from_jsons( [ json ], id )
this.$.$mol_state_local.value( `${this}.plot_raw_example('${id}')`, plot_raw.data() )
return plot_raw
}
Expand Down
2 changes: 1 addition & 1 deletion plot/bar/bar.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace $.$$ {
export class $mpds_visavis_plot_bar extends $.$mpds_visavis_plot_bar {

json() {
return $mpds_visavis_plot_bar_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_bar_json( this.plot_raw().jsons()[0] )
}

@ $mol_mem
Expand Down
1 change: 0 additions & 1 deletion plot/cube/cube.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ $mpds_visavis_plot_cube $mol_view
plot_raw $mpds_visavis_plot_raw
auto /
<= subscribe_click null
multi_jsons? null
show_setup true
show_fixel? true
heatmap? false
Expand Down
16 changes: 8 additions & 8 deletions plot/cube/cube.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace $.$$ {
setup() {
return [
... this.show_fixel() ? [ this.Fixel() ] : [],
... this.multi_jsons() ? [ this.Intersection_on() ] : [],
... this.plot_raw().jsons().length > 1 ? [ this.Intersection_on() ] : [],
this.Nonformers(),
... this.show_setup() ? [ this.X_order(), this.Y_order(), this.Z_order() ] : [],
]
Expand All @@ -39,13 +39,13 @@ namespace $.$$ {
plot_body() {
return [
this.Root(),
... this.multi_jsons() ? [ this.Cmp_legend() ] : [],
... this.plot_raw().jsons().length > 1 ? [ this.Cmp_legend() ] : [],
... this.heatmap() ? [ this.Side_right() ] : [],
]
}

json() {
return $mpds_visavis_plot_cube_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_cube_json( this.plot_raw().jsons()[0] )
}

@ $mol_mem
Expand Down Expand Up @@ -74,7 +74,7 @@ namespace $.$$ {

@ $mol_mem
heatmap_diif() {
const jsons = this.multi_jsons() as typeof $mpds_visavis_plot_cube_json.Value[]
const jsons = this.plot_raw().jsons() as typeof $mpds_visavis_plot_cube_json.Value[]
if( jsons?.length == 2 ) {
return jsons.every( json => json.payload.points.v.some(val => Math.floor(val) !== val) )
}
Expand All @@ -85,7 +85,7 @@ namespace $.$$ {
heatmap() {
if( this.heatmap_diif() ) return this.intersection_only()

const jsons = this.multi_jsons() as typeof $mpds_visavis_plot_cube_json.Value[]
const jsons = this.plot_raw().jsons() as typeof $mpds_visavis_plot_cube_json.Value[]
let json = this.json()
if( jsons?.length == 1 ) json = jsons[0]

Expand Down Expand Up @@ -171,7 +171,7 @@ namespace $.$$ {
@ $mol_mem
points_traversed() {

const jsons = this.multi_jsons() ?? [ this.json() ]
const jsons = this.plot_raw().jsons()

const values_by_label: Record<
string/*json index*/,
Expand Down Expand Up @@ -297,7 +297,7 @@ namespace $.$$ {
@ $mol_mem
multi_dataset(): any[] | null {

if( ! this.multi_jsons() ) return null
if( this.plot_raw().jsons().length === 1 ) return null

this.nonformers_checked( false )

Expand All @@ -310,7 +310,7 @@ namespace $.$$ {

@ $mol_mem
cmp_labels() {
return this.multi_jsons() ? this.multi_jsons()!.map( (json: any) => json.answerto ) : []
return this.plot_raw().jsons().length > 1 ? this.plot_raw().jsons()!.map( (json: any) => json.answerto ) : []
}

@ $mol_mem
Expand Down
2 changes: 1 addition & 1 deletion plot/customscatter/customscatter.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace $.$$ {
export class $mpds_visavis_plot_customscatter extends $.$mpds_visavis_plot_customscatter {

json() {
return $mpds_visavis_plot_customscatter_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_customscatter_json( this.plot_raw().jsons()[0] )
}

@ $mol_mem
Expand Down
2 changes: 1 addition & 1 deletion plot/discovery/discovery.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $mpds_visavis_plot_discovery $mol_view
plot_raw $mpds_visavis_plot_raw
auto /
<= subscribe_click null
json_cmp? null
json_cmp null
elementals_on? /
show_setup true
discovery_click? null
Expand Down
12 changes: 9 additions & 3 deletions plot/discovery/discovery.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ namespace $.$$ {
}

json() {
return $mpds_visavis_plot_discovery_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_discovery_json( this.plot_raw().jsons()[0] )
}

json_cmp() {
const json_cmp = this.plot_raw().jsons()[1]
return json_cmp ? $mpds_visavis_plot_discovery_json( json_cmp ) : null
}

elementals_dict() {
Expand Down Expand Up @@ -214,7 +219,7 @@ namespace $.$$ {
data() {

const json = this.json()
const json_cmp = this.json_cmp() ? $mpds_visavis_plot_discovery_json( this.json_cmp() ) : null
const json_cmp = this.json_cmp()

const elementals_on = this.elementals_on()

Expand Down Expand Up @@ -245,7 +250,8 @@ namespace $.$$ {

@ $mol_mem
cmp_labels() {
return this.json_cmp() ? [ this.json().answerto, this.json_cmp().answerto ] : []
const cmp = this.json_cmp()
return cmp ? [ this.json().answerto, cmp.answerto ] : []
}

}
Expand Down
2 changes: 1 addition & 1 deletion plot/eigen/eigen.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace $.$$ {
export class $mpds_visavis_plot_eigen extends $.$mpds_visavis_plot_eigen {

json() {
return $mpds_visavis_plot_eigen_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_eigen_json( this.plot_raw().jsons()[0] )
}

@ $mol_mem
Expand Down
2 changes: 1 addition & 1 deletion plot/graph/graph.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace $.$$ {

@ $mol_mem
json() {
return $mpds_visavis_plot_graph_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_graph_json( this.plot_raw().jsons()[0] )
}

plot_title() {
Expand Down
2 changes: 1 addition & 1 deletion plot/heatmap/heatmap.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace $.$$ {
export class $mpds_visavis_plot_heatmap extends $.$mpds_visavis_plot_heatmap {

json() {
return this.plot_raw().json() as any
return this.plot_raw().jsons()[0]
// return $mpds_visavis_plot_heatmap_json( this.plot_raw().json() as any )
}

Expand Down
1 change: 0 additions & 1 deletion plot/matrix/matrix.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ $mpds_visavis_plot_matrix $mol_view
auto /
<= size_debounced 0
<= auto_reorder null
multi_jsons? null
json_master null
show_setup true
size? 0
Expand Down
20 changes: 7 additions & 13 deletions plot/matrix/matrix.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace $.$$ {
@ $mol_mem
setup() {
return [
... this.json().payload.fixel ? [ this.Fixel() ] : [],
... this.multi_jsons() ? [ this.Intersection_on() ] : [],
... this.json_master().payload.fixel ? [ this.Fixel() ] : [],
... this.plot_raw().jsons().length > 1 ? [ this.Intersection_on() ] : [],
this.Nonformers(),
... this.show_setup() ? this.sorting() : [],
]
Expand All @@ -65,16 +65,11 @@ namespace $.$$ {
this.Root(),
... this.x_op() ? [ this.X_label() ] : [],
... this.y_op() ? [ this.Y_label() ] : [],
... this.multi_jsons() ? [ this.Cmp_legend() ] : [],
... this.plot_raw().jsons().length > 1 ? [ this.Cmp_legend() ] : [],
... this.heatmap() ? [ this.Side_right() ] : [],
]
}

@ $mol_mem
json() {
return $mpds_visavis_plot_matrix_json( this.plot_raw().json() as any )
}

@ $mol_mem
sort_dict() {
return $mpds_visavis_elements_list.prop_names()
Expand All @@ -94,14 +89,13 @@ namespace $.$$ {

@ $mol_mem
cmp_labels() {
return this.multi_jsons() ? this.multi_jsons()!.map( (json: any) => json.answerto ) : []
const jsons = this.plot_raw().jsons()
return jsons.length > 1 ? jsons.map( json => json.answerto ) : []
}

@ $mol_mem
json_master() {
if ( ! this.multi_jsons() ) return this.json()

const jsons: any[] = this.multi_jsons()!
const jsons = this.plot_raw().jsons()

const json_master = JSON.parse( JSON.stringify(
$mpds_visavis_plot_matrix_json( jsons[0] )
Expand Down Expand Up @@ -203,7 +197,7 @@ namespace $.$$ {
return 'entries'
}

const datesets_quantity = this.multi_jsons()?.length || 1
const datesets_quantity = this.plot_raw().jsons().length
if( datesets_quantity == heatmap_datasets.size && heatmap_datasets.size <= 2 ) {
return 'heatmap'
}
Expand Down
2 changes: 1 addition & 1 deletion plot/phase/phase.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace $.$$ {
export class $mpds_visavis_plot_phase extends $.$mpds_visavis_plot_phase {

json() {
return $mpds_visavis_plot_phase_rect_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_phase_rect_json( this.plot_raw().jsons()[0] )
}

json_title_b() {
Expand Down
2 changes: 1 addition & 1 deletion plot/pie/pie.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace $.$$ {
export class $mpds_visavis_plot_pie extends $.$mpds_visavis_plot_pie {

json() {
return $mpds_visavis_plot_pie_json( this.plot_raw().json() as any )
return $mpds_visavis_plot_pie_json( this.plot_raw().jsons()[0] )
}

@ $mol_mem
Expand Down
27 changes: 26 additions & 1 deletion plot/plot.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,32 @@ namespace $.$$ {
},
zIndex: 1,
cursor: 'default',
}
},

Error: {
position: 'absolute',
width: '50%',
height: '50%',
left: '25%',
top: '25%',

justify: {
content: 'center'
},
align: {
items: 'center',
},

background: {
color: $mol_theme.back,
},
border: {
radius: $mol_gap.round,
},

zIndex: 1,
cursor: 'default',
},

} )

Expand Down
19 changes: 9 additions & 10 deletions plot/plot.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ $mpds_visavis_plot $mol_view
Locale $mol_locale_select
value <= locale \en
json_request? null
json null
json_cmp_request? null
json_cmp null
multi_requests? /string
multi_jsons null
plot_raw null
show_setup false
notify? null
Fullscreen $mol_check
Icon <= Expand_icon $mol_icon_arrow_expand_all
checked? <=> fullscreen? false
show_demo_warn? false
Demo_warn $mol_paragraph
title \You are using the limited demo. Buy the full access and support our work.
sub /
^ demo_warn_visible / <= Demo_warn $mol_paragraph
title \You are using the limited demo. Buy the full access and support our work.
<= Fullscreen $mol_check
Icon <= Expand_icon $mol_icon_arrow_expand_all
checked? <=> fullscreen? false
<= Plot $mol_view
^ error_visible / <= Error $mol_view
sub / <= error_message \
plots *
matrix <= Matrix $mpds_visavis_plot_matrix
plot_raw <= plot_raw
multi_jsons <= multi_jsons
show_setup <= show_setup
nonformers_checked? <=> nonformers_checked? false
fixel_checked? <=> matrix_fixel_checked? true
Expand All @@ -34,7 +35,6 @@ $mpds_visavis_plot $mol_view
matrix_click? <=> matrix_click? null
plot3d <= Cube $mpds_visavis_plot_cube
plot_raw <= plot_raw
multi_jsons <= multi_jsons
show_setup <= show_setup
show_fixel? <= show_fixel? true
nonformers_checked? <=> nonformers_checked?
Expand All @@ -55,7 +55,6 @@ $mpds_visavis_plot $mol_view
bar_click? <=> bar_click? null
discovery <= Discovery $mpds_visavis_plot_discovery
plot_raw <= plot_raw
json_cmp <= json_cmp
show_setup <= show_setup
elementals_on? => discovery_elementals_on?
discovery_click? <=> discovery_click? null
Expand Down
Loading