Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi comparison (matrix, cube) #15

Merged
merged 16 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
6 changes: 0 additions & 6 deletions app/app.view.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ namespace $.$$ {
basis: '25rem',
shrink: 0,
},
Body: {
padding: $mol_gap.block,
},
Foot: {
padding: $mol_gap.block,
},
},

History_upload: {
Expand Down
11 changes: 5 additions & 6 deletions app/app.view.tree
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,8 @@ $mpds_visavis_app $mol_book2
<= Plot_opened null
Plot_page* $mol_page
title <= plot_id* \
body /
<= Plot_view* $mpds_visavis_plot
plot_raw <= plot_raw* null
show_setup true
show_fixel false
show_demo_warn false
Body_content <= Plot_view* $mpds_visavis_plot
plot_raw <= plot_raw* null
show_setup true
show_fixel false
show_demo_warn false
9 changes: 6 additions & 3 deletions app/app.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ namespace $.$$ {

@ $mol_action
files_read(next: readonly File[]) {
const data = $mol_wire_sync( $mol_blob_json )( next[0] )
for (const file of next) {

const plot_raw = $mpds_visavis_plot_raw_from_json( data, next[0].name )
const data = $mol_wire_sync( $mol_blob_json )( file )
stan-donarise marked this conversation as resolved.
Show resolved Hide resolved

this.plot_opened_id( this.history_add( plot_raw ) )
const plot_raw = $mol_wire_sync( $mpds_visavis_plot_raw_from_json )( data, file.name )

this.plot_opened_id( this.history_add( plot_raw ) )
}
}

@ $mol_action
Expand Down
22 changes: 0 additions & 22 deletions lib/lib.ts

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions lib/pca/pca.meta.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require \/mpds/visavis/lib/pca/_pca.js
5 changes: 5 additions & 0 deletions lib/pca/pca.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace $ {

export const $mpds_visavis_lib_pca = require('../mpds/visavis/lib/pca/_pca.js')

}
File renamed without changes.
1 change: 1 addition & 0 deletions lib/plotly/plotly.meta.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require \/mpds/visavis/lib/plotly/_plotly.custom.min.js
5 changes: 5 additions & 0 deletions lib/plotly/plotly.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace $ {

export const $mpds_visavis_lib_plotly = require('../mpds/visavis/lib/plotly/_plotly.custom.min.js')

}
4 changes: 4 additions & 0 deletions plotly/plotly.view.css → lib/plotly/view/view.view.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.js-plotly-plot {
position: absolute;
}

/* default plotly styles for shadow DOM */
.js-plotly-plot .plotly button,
.js-plotly-plot .plotly input,
Expand Down
11 changes: 11 additions & 0 deletions lib/plotly/view/view.view.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace $.$$ {

$mol_style_define( $mpds_visavis_lib_plotly_view, {

flex: {
grow: 1
},

} )

}
7 changes: 4 additions & 3 deletions plotly/plotly.view.tree → lib/plotly/view/view.view.tree
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
$mpds_visavis_plotly $mol_view
data *
$mpds_visavis_lib_plotly_view $mol_view
sub /
<= Plotly_root null
data /
layout *
subscribe_events null
plot_options *
displaylogo false
displayModeBar false
Expand Down
30 changes: 30 additions & 0 deletions lib/plotly/view/view.view.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace $.$$ {

export class $mpds_visavis_lib_plotly_view extends $.$mpds_visavis_lib_plotly_view {

@ $mol_mem
size() {
if ( !this.view_rect() ) return
const { width, height } = this.view_rect()!
return { width, height }
}

@ $mol_mem
Plotly_root() {
if ( !this.size() ) return
const { width, height } = this.size()!

const plotly_root = $mol_wire_sync( document ).createElement( 'div' ) as HTMLElement
const plotly_root_actual = $mol_wire_sync( $mpds_visavis_lib_plotly ).react(
plotly_root,
this.data(),
{ ...this.layout(), width, height },
this.plot_options(),
)

return plotly_root_actual
}

}

}
18 changes: 17 additions & 1 deletion plot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,15 @@ visavis_plot.notify = ( msg ) => alert( msg )

**`json_request( next?: string ) : string`**

Request url to get JSON (plot data)
Request URL to get JSON (plot data)

**`json_cmp_request( next?: string | null ) : string | null`**

Second request URL to get JSON for comparison (matrix, cube and discovery plots)

**`multi_requests( next?: string[] ) : string[]`**

Multiple request URLs to get JSON for comparison (matrix and cube plots)

**`notify( msg: string ) : void`**

Expand Down Expand Up @@ -69,6 +77,14 @@ Called when a cube element is clicked

Called when a phase section is clicked

**`nplots_changed( n: number ) : void`**

Called when the number of customscatter plots changes

**`legend_click( { plotindex: number, name: string } ) : void`**

Called when the curve legend is clicked (customscatter)

**`matrix_x_sort( next?: string ) : string`**

Element property name that determines the order of matrix elements along the x-axis
Expand Down
4 changes: 3 additions & 1 deletion plot/bar/bar.view.tree
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
$mpds_visavis_plot_bar $mpds_visavis_plotly
$mpds_visavis_plot_bar $mpds_visavis_lib_plotly_view
plot_raw $mpds_visavis_plot_raw
auto /
<= subscribe_click null
bar_click? null
17 changes: 10 additions & 7 deletions plot/bar/bar.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@ namespace $.$$ {
return $mpds_visavis_plot_bar_json( this.plot_raw().json() as any )
}

@ $mol_action
subscribe_events() {
@ $mol_mem
auto() {
return super.auto()
}

const d3 = $mpds_visavis_lib.d3()
@ $mol_mem
subscribe_click() {
const plotly_root = this.Plotly_root()
if (! plotly_root ) return

const json = this.json() as any

if (json.payload2 && json.p1ayload2.x && json.payload2.y) return

// warn_demo();1
// if (visavis.mpds_embedded) document.getElementById('expander').style.display = 'block';
const paths = d3.select( this.dom_node_actual() ).selectAll( 'g.point path' )
const paths = $mpds_visavis_lib_plotly.d3.select( plotly_root ).selectAll( 'g.point path' )

const that = this
paths.on('click', function(this: any, event: MouseEvent){
const selection = d3.select(this)
const selection = $mpds_visavis_lib_plotly.d3.select(this)
const value = selection.data()[0].x
that.bar_click( { facet: "years", value } )
});
Expand Down
20 changes: 11 additions & 9 deletions plot/cube/cube.view.tree
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
$mpds_visavis_plot_cube $mol_view
plot_raw $mpds_visavis_plot_raw
json_cmp? null
auto /
<= subscribe_click null
multi_jsons? null
show_setup true
show_fixel? true
heatmap? false
Expand Down Expand Up @@ -37,13 +39,13 @@ $mpds_visavis_plot_cube $mol_view
sub /
<= Plot $mol_view
sub <= plot_body /
<= Root $mpds_visavis_plotly
data <= data_shown *
<= Root $mpds_visavis_lib_plotly_view
data <= data_shown /
layout <= layout *
subscribe_events <= subscribe_events null
Plotly_root => Plotly_root
<= Cmp_legend $mpds_visavis_plot_legend_cmp
first_cmp_label? <= first_cmp_label? \
second_cmp_label? <= second_cmp_label? \
labels <= cmp_labels /
colorset <= colorset
<= Side_right $mol_scroll
sub /
<= Heatmap_legend $mol_list
Expand All @@ -61,9 +63,9 @@ $mpds_visavis_plot_cube $mol_view
hint \Continuous solid solutions and complete insolubility systems
title \Show non-formers
checked? <=> nonformers_checked? false
<= Diffrence_on $mol_check_box
title \Show diffrence
checked? <=> diffrence_checked? false
<= Difference_on $mol_check_box
title \Show difference
checked? <=> difference_checked? false
<= X_order $mol_labeler
title \X sort by
Content <= X_order_select $mol_select
Expand Down
Loading
Loading