FVANCOP / ChartNew.js

MIT License
420 stars 143 forks source link

Different background color in canvas in connection with label #488

Closed luna2761 closed 7 years ago

luna2761 commented 7 years ago

Hello, Francois!

Again, that's not an issue, however I wonder if it is possible to have different backgrounds in canvas? For example, for (within) some labels - one color, for some labels - another.

Thank you in advance.

FVANCOP commented 7 years ago

Hello,

If you mean the color of the inGraphData, the option inGraphDataFontColor can be associated to a function (like lot of other options).

something like this :

function setFontColor(area,ctx,data,statdata,i,j,othervars) { if(i==0)return("red"); else return("blue");
}

inGraphDataFontColor : setFontColor,

luna2761 commented 7 years ago

Hi again,

No, what I mean is background color - canvasBackgroundColor, but different for different labels.

Here is the picture, I think it explains better than I do)) untitled

FVANCOP commented 7 years ago

It should be possible - I will send you a sample in a couple of day.

FVANCOP commented 7 years ago

Hi,

Download the last version (module Add-ins/shapesInChart.js has been changed) and check new sample Samples/highLight5.html.

Regards, François

PS : wiki documentation will be updated soon.

luna2761 commented 7 years ago

Hi,

I've checked the example https://github.com/FVANCOP/ChartNew.js/blob/master/Samples/highLight5.html, however I see, that canvas background is always white. Is this correct path?

FVANCOP commented 7 years ago

Hi,

Have you also downloaded the new Add-ins/shapesInChart.js module ?

Following link is working fine for me :

http://fvancop.github.io/ChartNew.js/Samples/highLight5.html

canvas

luna2761 commented 7 years ago

This is what I see when I open the link http://fvancop.github.io/ChartNew.js/Samples/highLight5.html: lnk

The same when I've downloaded the new Add-ins/shapesInChart.js and used highLight5.html.

FVANCOP commented 7 years ago

I think that (again) I misunderstand your request. You want it for each group of rectangle, not when the mouse is hovering a rectangle.... In the sample that I provided, a background rectangle appears when the mouse is hovering a rectangle.

You need something similar to http://fvancop.github.io/ChartNew.js/Samples/third_bar.html but with another color for each group of rectangles (in third_bar.html they are all pink), behind the rectangles and up to the top of the chart. Correct ?

luna2761 commented 7 years ago

In the sample that I provided, a background rectangle appears when the mouse is hovering a rectangle Yes, it should be kind of this, looks great)), but permanently, not when the mouse hovers it.

FVANCOP commented 7 years ago

New sample has been added : Samples/bars_with_background_color.html.

Link for this sample : http://fvancop.github.io/ChartNew.js/Samples/bars_with_background_color.html

In this sample, 3 layouts are produced. Choose the more appropriate.

If you have other questions concerning this issue, please contact me by mail (and not through the issue) in order to avoid lot of mails generated to all the followers.

Regards, François