0

With reference to following Implementation of Streamgraph http://bl.ocks.org/WillTurman/4631136 If we have 8 Keys then there will be 8 Layers mapped to 8 different colors.

Now If we have the following dataset:

    [T1][T2][T3][T4]
    [ 1][ 2][--][--]
    [ 3][ 4][ 5][--]
    [ 6][--][--][17]
    [ 7][--][--][--]
    [ 8][ 9][10][11]
    [--][13][--][--]
    [--][--][15][16]
Here 1-16 are datapoints with weight x
-- are null datapoints with no weight

I need to implement the above table with the following Criteria:

  1. 1 & 2 be Color A
  2. 3,4,5 be Color B
  3. 6 be Color C
  4. 17 be Color D
  5. 7 be Color E
  6. 8,9,10,11 be Color F
  7. 13 be Color G
  8. 15,16 be Color H

So How should I assign different color to the same layer

Can the same layer map to different color? by giving the following input parameter:

Layer/Key
Date
Value
Color

Ronak Agrawal
  • 438
  • 3
  • 13
  • If I understand you correctly you could use an [ordinal scale](https://github.com/mbostock/d3/wiki/Ordinal-Scales). Pass in an array of numbers as your input (domain) and map them to the colours in the output (range). – user1614080 Jan 04 '15 at 01:51
  • @user1614080 Thanks for response. I didnot get how should I map the numbers to color which ultimately maps to Layer. Kindly Look at this Image http://postimg.org/image/mn3imv4if/ Here Each Color in a new Layer or a New Key The Layer succeeding the set of Layers shows a downfall effect which I dont want So how should I implement stream graph which ll remove this effect Can the same layer map to different color? by giving the following input parameter: Layer/Key
    Date
    Value
    Color
    – Ronak Agrawal Jan 05 '15 at 06:43

0 Answers0