Creazione della proprietà "Valore Colori".Come posso creare uno script per la creazione di un set di colori di valore per una colonna della tabella dati senza dover specificare cosa sono effettivamente?
Lo chiedo perché ho un'applicazione che si aspetta di trovare una proprietà "Colori valore" associata a una colonna selezionata e andrà in crash se quella proprietà non esiste. Non voglio dover definire i colori stessi perché sono irrilevanti: ho solo bisogno che ci sia essere una proprietà Value Colors.
Posso farlo molto facilmente in modo interattivo semplicemente facendo clic con il pulsante destro del mouse sulla colonna in questione e selezionando "Colori valore" dall'elenco delle proprietà, dopodiché viene definito automaticamente un set predefinito per me. È essenzialmente questa operazione quindi che ho bisogno di scrivere - e immagino che la soluzione sarà una singola riga di codice, ma temo di non riuscire a vederla. Qualcuno può aiutare?
Re: Creazione della proprietà "Value Colors".Perfetto!Sempre meglio chiedere agli esperti che cercare di ottenere Quello tipo di costruzione giusto 
Molte grazie, Jim!
Re: Creazione della proprietà "Value Colors".ExprList non viene costruito correttamente.Devi avere i valori letterali nell'elenco, non i valori calcolati.Ecco un modo per farlo
// Start of script;
Names Default To Here( 1 );
Clear Log();
dt = Open( "$SAMPLE_DATA/Big Class.JMP" );
Summarize( NamesList = by( :Name ) );
Show( NamesList );
// Build the ExprLIst to be exactly what the Value Colors
// list needs to be
ExprList = {};
For( i = 1, i <= N Items( NamesList ), i++,
Eval(
Substitute(
Expr(
Insert Into( ExprList, Expr( __Names__ = __color__ ) )
),
Expr( __Names__ ), NamesList[i],
Expr( __color__ ), 2 + i
)
)
);
Show( ExprList );
// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.
:Name << set property( "Value Colors", ExprList );
// The Value Colors property is correct;
Show( :Name << get property( "Value Colors" ) );Re: Creazione della proprietà "Value Colors".Mille grazie a Peter e CWillden per il vostro aiuto; purtroppo non ci sono ancora - ma sono riuscito a cristallizzare un po' il problema.Lo script allegato mostra dove sono arrivato ora: se riesco a risolvere l'ultima difficoltà relativa a come creare un elenco di espressioni che posso poi inserire nella proprietà Value Colors, dovrei essere in grado di ottenere ciò di cui ho bisogno:
// Start of script;
clear log();
dt = Open( "$SAMPLE_DATA/Big Class.JMP" );
// The Value Colors property of the first column is initially empty;
show(:Name << get property("Value Colors"));
/*
I now want to create a Value Colors property for this column,
but I'd prefer to do it without having to identify all the names
beforehand if possible. Try CWillden's suggestion...
*/
:Name << set property("Value Colors", {});
// If I now try to color the cells by value, it DOES actually seem to have worked;
:Name << color cell by value(1);
// But the Value Colors property STILL only contains an empty list;
show(:Name << get property("Value Colors"));
/*
Unfortunately I do actually need a populated list - and it looks like I can't do it
without extracting the names explicity. Here's one way I think I COULD do it...
*/
summarize(NamesList=by(:Name));
show(NamesList);
/*
I now need to put those names into a list of expressions that follow the syntax
shown in PMRoz's post, and use that list to define the Value Colors property I need.
This next bit is WRONG - but you can see what I'm trying to do here.
What I need inside ExprList is a list of names, each coupled with an integer from 3 onwards
(to get some colors starting at red). I suspect I should probably be using the Substitute
and/or Eval Expr functions at this point, but I can't get the correct syntax.
*/
ExprList = {};
for(i=1, i<=nItems(NamesList), i++,
insert into(ExprList, expr(NamesList[i] = (2+i)))
);
show(ExprList);
// Then insert the resulting expression as the Value Colors property of the :Names column, and I should get what I want.
:Name << set property("Value Colors", ExprList);
// End of script.Re: Creazione della proprietà "Value Colors".Sono stato in grado di inserire una proprietà BS value colors in una colonna facendo questo:
:Column 1 << Set Property("Value Colors",{});Sembra che l'applicazione dovrebbe davvero essere aggiornata per funzionare in modo più affidabile.Requisito strano.
Re: Creazione della proprietà "Value Colors".Puoi usare JSL in questo modo:
column(dt, "Column 1") << Set Property( "Value Colors", {2 = 45, 3 = 46, 4 = 47} );
Il modo per capirlo è farlo
1. Creare una piccola tabella fittizia con una singola colonna numerica
2. Aggiungere manualmente il file Valore Colori attributo
3. Fare clic sul piccolo triangolo rosso accanto al nome della tabella e selezionare Copia lo script della tabella
4. Apri una finestra di script JSL e incolla il codice risultante.
Sarà simile a questo:
New Table( "Untitled 14",
Add Rows( 3 ),
New Column( "Column 1",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Property( "Value Colors", {1 = -13977687, 2 = -3780931, 3 = -4222943} ),
Set Selected,
Set Values( [1, 2, 3] )
)
);