Welcome Guest Search | Active Topics |

How to get the fillStyle of the current series
jasonysli
#1 Posted : Wednesday, October 9, 2013 12:32:55 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/9/2013(UTC)
Posts: 3

Thanks: 4 times
Was thanked: 0 time(s) in 0 post(s)
Dears

Hi this plug-in is so awesome ! You Guys so Amazing

And I have a question :

I can get the fillStyle of the series which i clicked.

But i can't get the properties of the current series array.

$(chartName).bind('legendItemMouseDown', function (e, data) {

var fillStyle = data.series[0].fillStyle;

var series = $(chartName).jqChart('option', 'series');

var firstSeriesFillStyle = series[0].fillStyle; // <- How to get the fillStyle in this case?


}



Ivan
#2 Posted : Wednesday, October 9, 2013 6:56:46 AM(UTC)
Rank: Administration

Groups: Administrators, Moderator, Registered
Joined: 11/5/2012(UTC)
Posts: 131

Thanks: 0 times
Was thanked: 15 time(s) in 15 post(s)
In the "$(chartName).bind('legendItemMouseDown', function (e, data)" you can just use:

Code:
var fillStyle = data.series.fillStyle;
Best,
Ivan Petrov
jqChart Inc.
1 user thanked Ivan for this useful post.
jasonysli on 10/13/2013(UTC)
jasonysli
#3 Posted : Sunday, October 13, 2013 9:06:08 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/9/2013(UTC)
Posts: 3

Thanks: 4 times
Was thanked: 0 time(s) in 0 post(s)
Thanks for your reply!

So i can just know the legend name which i clicked but not the fillStyle :o?

i wonder how to keep the rest series fillstyle while i remove the specific series dynamically :)
Dragan
#4 Posted : Monday, October 14, 2013 2:00:21 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
You can set fill styles of each of your series, so you'll keep their colors when add/remove series.

Code:
series: [
      {   
          fillStyle: '#418CF0'



http://www.jqchart.com/jquery/chart/ChartTypes/ColumnChart
Best Regards,
Dragan Matek
jqChart Inc.
1 user thanked Dragan for this useful post.
jasonysli on 10/17/2013(UTC)
jasonysli
#5 Posted : Thursday, October 17, 2013 8:25:09 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/9/2013(UTC)
Posts: 3

Thanks: 4 times
Was thanked: 0 time(s) in 0 post(s)
Thx,Dragon

Because of the series is created dynamically, i don't think the fillStyle can be set on the script (?)

Should i use a Session(DataTable) to store the fillstyle :/ ?

Dragan
#6 Posted : Tuesday, October 22, 2013 6:06:51 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
You can set fillStyle when you add a new series:
Code:
var newSeries = {
    type: 'line',
    fillStyle : 'red',
    data: data
  };

series.push(newSeries);

Best Regards,
Dragan Matek
jqChart Inc.
1 user thanked Dragan for this useful post.
jasonysli on 10/23/2013(UTC)
Users browsing this topic
Guest (5)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.108 seconds.