Find the fill/blend modes of chart grid difficult

Get help and support using chartsEngine for LiveCode.

Moderators: heatherlaine, BvG

Post Reply
BillJames
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9
Joined: Tue Feb 10, 2009 2:14 am

Find the fill/blend modes of chart grid difficult

Post by BillJames » Mon Jan 04, 2010 4:41 am

I would like to set the background of the chart to one color (easy enough) and be able to set either the YFill to alternate colors or XFill to alternate colors. I have experimented with the blend modes but find it difficult to achieve what I really want which is just to set the fill colors with no blending with the background. Any way I can do this? One idea I had was to have two rectangle backgrounds (one behind the fill areas and the existing background behind both) where I could set the grid fill background to all white which would at least enable the blending I desire.

Thanks, Bill

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Find the fill/blend modes of chart grid difficult

Post by malte » Wed Jan 06, 2010 11:11 pm

Hey Bill.

I am not sure I completely get what you are trying to do. Can you elaborate a bit?

Cheers,

malte

BillJames
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9
Joined: Tue Feb 10, 2009 2:14 am

Re: Find the fill/blend modes of chart grid difficult

Post by BillJames » Fri Jan 08, 2010 3:48 am

Malte,

I will try to explain what I was trying to do.

I was experimenting with the ways to color the chart grids. Here I what I think I understand:

1. If you don't set a background color for the chart, the chart (including the grid) will use the card background, or
2. You can set a chart background color and the chart (including the grid) will use the background, or
3. You can set a chart background color, set the grid fill colors by setting the XFill and YFill colors and set blend modes.

What I want to do is pick a color for the background (this is the color I want outside the grid) and pick horizontal or vertical colors for the grid fill (I don't even desire both) and set the fill to the exact colors I want. I don't want to blend the grid fill colors with the background. Do you have to use fill modes if you choose XFill or YFill colors? I assumed that you do from the example script. Maybe not and that may be my confusion.


Thanks,

BIll

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Re: Find the fill/blend modes of chart grid difficult

Post by malte » Fri Jan 08, 2010 11:56 am

Hi Bill,

if you do not set the color properties for the grid they will be rendered as transparent graphics. For setting a color for the complete chart, there is no method as yet. However, a chart is a group, so if you set the opaque of the group that contains the chart to true and afterwards set its backgroundColor you should be set. Maybe I should think about implementing a command to set that in the lib. Charts will get a bigger update in Q2 this year, so if you have any feature requests, this is a good time to keep them coming.

All the best,

Malte

BillJames
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9
Joined: Tue Feb 10, 2009 2:14 am

Re: Find the fill/blend modes of chart grid difficult

Post by BillJames » Sat Jan 09, 2010 5:36 pm

Malte,

The code below is very close to what I was trying to achieve with the exception of missing X grid lines. I assume when I set the YFills without XFills the X grid lines were not drawn at all or were somehow overlayed by the YFill. Are drawing of grid lines intended to be independent of the grid fill? I guess what I am asking is whether the grid lines can be drawn separately from the fill or can be "in front of" as the chart lines are. I hope that I am making sense. Thanks again,

Bill

Code: Select all

on mouseUp
   local tchart
   if exists(group "myChart") then delete group "myChart"
   if exists(group "myChart_legend") then delete group "myChart_legend"
   chartsCreateChart "myChart",100,100,600,400 --topleftx,toplefty,botrightx,botrighty
   set the charts["dataIncludesX"] of group "myChart" to true
   set the opaque of group "myChart" to true
   set the charts["chartBackgroundColor"] of group "myChart" to "beige"
   set the charts["chartColors"] of group "myChart" to "red" & cr & "blue" & cr & "green"
   set the charts["lineSizes"] of group "myChart" to "1"&cr&"1"&cr&"1"
   set the charts["legendNames"] of group "myChart" to "USA"&cr&"Europe"&cr&"Asia"
   set the charts["legendTextFont"] of group "myChart" to "Verdana"
   set the charts["legendTextColor"] of group "myChart" to "black"
   set the charts["legendTextSize"] of group "myChart" to 12
   set the charts["showLegend"] of group "myChart" to true
   set the topleft of group "myChart_legend" to 100,400 -- x,y
   set the charts["data"] of group "myChart" to "0,1,1,1" & cr & "1,30,56,12" & cr &  "2,1,1,1"
   set the charts["gridX"] of group "myChart" to 3
   set the charts["gridY"] of group "myChart" to 3
   set the charts["gridInFront"] of group "myChart" to false
   set the charts["showGridXDescription"] of group "myChart" to true
   set the charts["showGridYDescription"] of group "myChart" to true
   set the charts["minX"] of group "myChart" to 0 
   set the charts["maxX"] of group "myChart" to 2
   set the charts["minY"] of group "myChart" to 0
   set the charts["maxY"] of group "myChart" to 60
   set the charts["gridXDescriptionOrientation"] of group "myChart" to "normal" -- horizontally 
   #set the charts["gridXDescriptionOrientation"] of group "myChart" to "right" -- vertically, right 
   #set the charts["gridXDescriptionOrientation"] of group "myChart" to "left" -- vertically, left
   set the charts["gridYNumberFormat"] of group "myChart" to "#.0" 
   set the charts["gridXNumberFormat"] of group "myChart" to "#.0"
   set the charts["descriptionTextFont"] of group "myChart" to "Verdana"
   set the charts["descriptionTextSize"] of group "myChart" to 12
   set the charts["descriptionTextColor"] of group "myChart" to "black"
   set the charts["gridColor"] of grp "myChart" to "black"
   #set the charts["gridXFillColor"] of group "myChart" to ""
   set the charts["gridYFillColor"] of group "myChart" to "burlywood1"
   #set the charts["gridXFillAltColor"] of group "myChart" to ""
   set the charts["gridYFillAltColor"] of group "myChart" to "burlywood2" 
   #set the charts["gridXInk"] of group "myChart" to "blendMultiply"
   #set the charts["gridYInk"] of group "myChart" to "blendMultiply"
   set the charts["chartStyle"] of group "myChart" to "lines"
   set the charts["caption"] of group "myChart" to "My first chart"
   set the charts["captionTextFont"] of group "myChart" to "Verdana"
   set the charts["captionTextColor"] of group "myChart" to "black"
   set the charts["captionTextSize"] of grp "myChart" to 14
   set the charts["captionAlign"] of group "myChart" to "center" -- or "left" or "right"
   chartsRefresh the long Id of group "myChart"
end mouseUp

Post Reply

Return to “chartsEngine”