Focal Point
[SOLVED] Has anyone ever changed the series color of a chart dynamically....

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9757031786

July 03, 2017, 03:42 PM
Don Garland
[SOLVED] Has anyone ever changed the series color of a chart dynamically....
I have a line (JSCHART) chart with many many lines, each representing a 24hr period of the date range selected. It reminds me of like Widows Performance Monitor.

Just like performance monitor, I'd like to click on a series and turn the color to black so that I can see it among the many colored lines.

Anyone done anything like that?

I was thinking I could have the chart drill down to itself, pass the series id and change the color in the style sheet. Currently the series colors are automatically assigned so I'll probably have to take control of that.

I'll probably also want to capture the current color of the selected series so I can restore it when they click on another line.

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
July 03, 2017, 05:33 PM
Waz
I did play around with this a couple of months ago.

Mine was based on mouse-over on the legend to highlight the series.

I'll see if I can find the technique.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 03, 2017, 05:42 PM
Waz
This is the example of events on charts I did.

It may give some insights on what you want to do.

http://forums.informationbuild...317005486#8317005486


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 03, 2017, 05:57 PM
Waz
OK, this is a bit complicated, but with the events, you can change colour with :

With what I did, I had to "backup" the colours so I could restore them on mouse out.

for (var cs=0;cs<eventobject.chart.series.length;cs++) {
	if (eventobject.chart.getSeries(cs)) {
		if (cs == eventobject.series) continue ;
		if (eventobject.chart.getSeries(cs)) {
			eventobject.chart.set({series: [{series:cs,color: MyColour }]});
		}
	}
}
eventobject.chart.redraw();



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

July 05, 2017, 08:21 AM
Don Garland
nice idea.

Thank you,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
July 05, 2017, 11:57 AM
J.L. Hinds
Save this as jeffrey999.fex

-DEFAULTH &COUNTRY='_FOC_NULL';
GRAPH FILE CAR
HEADING
SUM CAR.BODY.DEALER_COST
BY COUNTRY NOPRINT
ON GRAPH SET LOOKGRAPH HBAR
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB ON
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID ON
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET STYLE *
DEFMACRO=COND0001,COLUMN=N2,MACTYPE=RULE,WHEN=COUNTRY EQ '&COUNTRY',$
DEFMACRO=COND0002,COLUMN=N2,MACTYPE=RULE,WHEN=COUNTRY NE '&COUNTRY',$
TYPE=DATA,COLOR=RGB(194 11 11),MACRO=COND0001,$
TYPE=DATA,COLOR=RGB(11 11 194),MACRO=COND0002,$
$
TYPE=DATA,
COLUMN=N2,
FOCEXEC=jeffrey999( \
COUNTRY=N1 \
),
TARGET='_self',
$
ENDSTYLE
END


WebFOCUS 7.6
Windows, All Outputs
July 05, 2017, 12:19 PM
Doug
Can you use "seriescolor(#)=&Color1"
Or something like that?
Or, do you want the series colors to be always consistent throughout?