diff --git a/plot/cube/cube.view.tree b/plot/cube/cube.view.tree index 093f9ed..0faa467 100644 --- a/plot/cube/cube.view.tree +++ b/plot/cube/cube.view.tree @@ -1,6 +1,6 @@ $mpds_visavis_plot_cube $mol_view plot_raw $mpds_visavis_plot_raw - json_cmp? null + multi_jsons? null show_setup true show_fixel? true heatmap? false @@ -42,8 +42,8 @@ $mpds_visavis_plot_cube $mol_view layout <= layout * subscribe_events <= subscribe_events null <= 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 diff --git a/plot/cube/cube.view.ts b/plot/cube/cube.view.ts index 8de9866..65b3b50 100644 --- a/plot/cube/cube.view.ts +++ b/plot/cube/cube.view.ts @@ -26,7 +26,7 @@ namespace $.$$ { setup() { return [ ... this.show_fixel() ? [ this.Fixel() ] : [], - this.json_cmp() ? this.Diffrence_on() : this.Nonformers(), + this.multi_jsons() ? this.Diffrence_on() : this.Nonformers(), ... this.show_setup() ? [ this.X_order(), this.Y_order(), this.Z_order() ] : [], ] } @@ -35,7 +35,7 @@ namespace $.$$ { plot_body() { return [ this.Root(), - ... this.json_cmp() ? [ this.Cmp_legend() ] : [], + ... this.multi_jsons() ? [ this.Cmp_legend() ] : [], ... this.heatmap() ? [ this.Side_right() ] : [], ] } @@ -135,32 +135,38 @@ namespace $.$$ { } @ $mol_mem - data_cmp() { - if (!this.json_cmp() ) return null + multi_dataset(): any[] | null { + if( ! this.multi_jsons() ) return null + this.nonformers_checked( false ) - this.first_cmp_label( this.json().answerto ) - this.second_cmp_label( this.json_cmp().answerto ) - return { - ...this.scatter3d_common(), - text: this.json_cmp().payload.points.labels, - marker: this.marker( 1 ), - ...this.convert_to_axes( - this.json_cmp().payload.points.x, - this.json_cmp().payload.points.y, - this.json_cmp().payload.points.z, - this.x_sort() as Prop_name, - this.y_sort() as Prop_name, - this.z_sort() as Prop_name, - ) - } + + return this.multi_jsons().map( (json: any, index: number) => { + return { + ...this.scatter3d_common(), + text: json.payload.points.labels, + marker: this.marker( index ), + ...this.convert_to_axes( + json.payload.points.x, + json.payload.points.y, + json.payload.points.z, + this.x_sort() as Prop_name, + this.y_sort() as Prop_name, + this.z_sort() as Prop_name, + ) + } + } ) + } + + @ $mol_mem + cmp_labels() { + return this.multi_jsons() ? this.multi_jsons()!.map( (json: any) => json.answerto ) : [] } @ $mol_mem data_shown() { return [ - ... this.nonformers_checked() ? [this.data_nonformers()] : [], - this.data(), - ... this.json_cmp() ? [this.data_cmp()] : [], + ... this.nonformers_checked() ? [ this.data_nonformers() ] : [], + ... this.multi_dataset() ? this.multi_dataset()! : [ this.data() ], ] } diff --git a/plot/legend/cmp/cmp.view.css.ts b/plot/legend/cmp/cmp.view.css.ts index 31abf47..f3dbec7 100644 --- a/plot/legend/cmp/cmp.view.css.ts +++ b/plot/legend/cmp/cmp.view.css.ts @@ -1,40 +1,34 @@ namespace $.$$ { - const Cmp_label: $mol_style_properties = { - color: 'white', - padding: { - left: $mol_gap.space, - right: $mol_gap.space, - } - } - $mol_style_define( $mpds_visavis_plot_legend_cmp, { + lineHeight: '1', + position: 'absolute', left: 0, bottom: 0, width: '100%', - gap: $mol_gap.block, - alignItems: 'center', - justifyContent: 'center', padding: { bottom: $mol_gap.space, }, - lineHeight: '1', - - First_cmp_label: { - ...Cmp_label, - background: { - color: '#3e3f95', - }, + + gap: $mol_gap.block, + align: { + items: 'center', }, + justify: { + content: 'center', + } - Second_cmp_label: { - ...Cmp_label, - background: { - color: '#c00', - }, - }, + } ) + + $mol_style_define( $mpds_visavis_plot_legend_cmp_label, { + + color: 'white', + padding: { + left: $mol_gap.space, + right: $mol_gap.space, + } } ) diff --git a/plot/legend/cmp/cmp.view.tree b/plot/legend/cmp/cmp.view.tree index 4ab37df..aef3282 100644 --- a/plot/legend/cmp/cmp.view.tree +++ b/plot/legend/cmp/cmp.view.tree @@ -1,7 +1,15 @@ $mpds_visavis_plot_legend_cmp $mol_view sub / - <= First_cmp_label $mol_view - sub / <= first_cmp_label? \ + <= Label*0 $mpds_visavis_plot_legend_cmp_label + label <= label* \ + background <= background* \ \vs. - <= Second_cmp_label $mol_view - sub / <= second_cmp_label? \ + <= Label*1 + labels / + colorset / + +$mpds_visavis_plot_legend_cmp_label $mol_view + sub / <= label \ + style * + ^ + background <= background \ diff --git a/plot/legend/cmp/cmp.view.ts b/plot/legend/cmp/cmp.view.ts new file mode 100644 index 0000000..d16841a --- /dev/null +++ b/plot/legend/cmp/cmp.view.ts @@ -0,0 +1,19 @@ +namespace $.$$ { + export class $mpds_visavis_plot_legend_cmp extends $.$mpds_visavis_plot_legend_cmp { + + sub(): readonly any[] { + return this.labels().length == 2 + ? super.sub() + : this.labels().map( ( label, ind ) => this.Label( ind ) ) + } + + label( index: number ): string { + return this.labels()[ index ] ?? '' + } + + background( index: number ): string { + return this.colorset()[ index ] ?? '' + } + + } +} diff --git a/plot/matrix/matrix.view.tree b/plot/matrix/matrix.view.tree index 6ac5916..a8a8311 100644 --- a/plot/matrix/matrix.view.tree +++ b/plot/matrix/matrix.view.tree @@ -1,6 +1,6 @@ $mpds_visavis_plot_matrix $mol_view plot_raw $mpds_visavis_plot_raw - json_cmp? null + multi_jsons? null json_master null show_setup true size 0 @@ -43,8 +43,8 @@ $mpds_visavis_plot_matrix $mol_view <= Root $mol_view render <= draw null <= 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 diff --git a/plot/matrix/matrix.view.ts b/plot/matrix/matrix.view.ts index 315bebd..e2d9e34 100644 --- a/plot/matrix/matrix.view.ts +++ b/plot/matrix/matrix.view.ts @@ -49,7 +49,7 @@ namespace $.$$ { setup() { return [ ... this.json().payload.fixel ? [ this.Fixel() ] : [], - this.json_cmp() ? this.Diffrence_on() : this.Nonformers(), + this.multi_jsons() ? this.Diffrence_on() : this.Nonformers(), ... this.show_setup() ? [ this.Order() ] : [], ] } @@ -58,7 +58,7 @@ namespace $.$$ { plot_body() { return [ this.Root(), - ... this.json_cmp() ? [ this.Cmp_legend() ] : [], + ... this.multi_jsons() ? [ this.Cmp_legend() ] : [], ... this.heatmap() ? [ this.Side_right() ] : [], ] } @@ -68,19 +68,28 @@ namespace $.$$ { return $mpds_visavis_plot_matrix_json( this.plot_raw().json() as any ) } + @ $mol_mem + cmp_labels() { + return this.multi_jsons() ? this.multi_jsons()!.map( (json: any) => json.answerto ) : [] + } + @ $mol_mem json_master() { - if ( !this.json_cmp() ) return this.json() - - const json_master = JSON.parse(JSON.stringify( this.json() )); - this.json_cmp().payload.links.forEach( (item: any)=> { - item.cmp = 1; - json_master.payload.links.push(item); - }); + if ( ! this.multi_jsons() ) return this.json() + + const jsons = this.multi_jsons()! + const json_master = JSON.parse( JSON.stringify( jsons[0] ) ) + + for (let i = 1; i < jsons.length; i++) { + const json = jsons[i] + json.payload.links.forEach( ( item: any ) => { + item.cmp = i + json_master.payload.links.push( item ) + } ) + } + this.nonformers_checked( false ) - this.first_cmp_label( this.json().answerto ) - this.second_cmp_label( this.json_cmp().answerto ) return $mpds_visavis_plot_matrix_json( json_master ) } diff --git a/plot/plot.view.tree b/plot/plot.view.tree index bcfa6fd..d6a23c3 100644 --- a/plot/plot.view.tree +++ b/plot/plot.view.tree @@ -7,6 +7,8 @@ $mpds_visavis_plot $mol_view json null json_cmp_request? null json_cmp null + multi_requests? / + multi_jsons null plot_raw null show_setup false notify? null @@ -19,7 +21,7 @@ $mpds_visavis_plot $mol_view plots * matrix <= Matrix $mpds_visavis_plot_matrix plot_raw <= plot_raw - json_cmp <= json_cmp + multi_jsons <= multi_jsons show_setup <= show_setup nonformers_checked? <=> nonformers_checked? false fixel_checked? <=> matrix_fixel_checked? true @@ -30,7 +32,7 @@ $mpds_visavis_plot $mol_view matrix_click? <=> matrix_click? null plot3d <= Cube $mpds_visavis_plot_cube plot_raw <= plot_raw - json_cmp <= json_cmp + multi_jsons <= multi_jsons show_setup <= show_setup show_fixel? <= show_fixel? true nonformers_checked? <=> nonformers_checked? diff --git a/plot/plot.view.ts b/plot/plot.view.ts index e7725f1..732da19 100644 --- a/plot/plot.view.ts +++ b/plot/plot.view.ts @@ -24,6 +24,13 @@ namespace $.$$ { return $mpds_visavis_plot.fetch_plot_json( this.json_cmp_request() ) } + @ $mol_mem + multi_jsons() { + return this.multi_requests().length > 0 + ? this.multi_requests().map( req => $mpds_visavis_plot.fetch_plot_json( req ) ) + : this.json_cmp() ? [ this.json(), this.json_cmp() ] : null + } + @ $mol_mem json_cmp_request( next?: string | null ) { if ( next === null && $mol_wire_probe( ()=> this.json_cmp_request() ) === null ) {