Skip to content

Instantly share code, notes, and snippets.

@larsvers
Last active August 29, 2015 14:04
Show Gist options
  • Save larsvers/eba988eb686cc333f7f9 to your computer and use it in GitHub Desktop.
Save larsvers/eba988eb686cc333f7f9 to your computer and use it in GitHub Desktop.
Circle Pack for Inference Models
{
"name": "All Data",
"children": [
{"name": "Brand associations", "key": 1,
"children": [
{"category": "Brand", "name": "Top of Mind Awareness Brand 11", "size": 46, "potential": 70, "nonPotential": 30, "key": 15},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 5", "size": 9, "potential": 35, "nonPotential": 65, "key": 29},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 18", "size": 1, "potential": 53, "nonPotential": 47, "key": 42},
{"category": "Brand", "name": "Unaided Awareness Brand 14", "size": 2, "potential": 57, "nonPotential": 43, "key": 58},
{"category": "Brand", "name": "Consideration to buy Brand 6", "size": 73, "potential": 74, "nonPotential": 26, "key": 110},
{"category": "Brand", "name": "Consideration to buy Brand 9", "size": 10, "potential": 43, "nonPotential": 57, "key": 113},
{"category": "Brand", "name": "Equity Brand 9", "size": 7, "potential": 28, "nonPotential": 72, "key": 153},
{"category": "Brand", "name": "Rejection Brand 13", "size": 4, "potential": 49, "nonPotential": 51, "key": 177},
{"category": "Brand", "name": "Recommendation Brand 3", "size": 1, "potential": 50, "nonPotential": 50, "key": 187},
{"category": "Brand", "name": "Recommendation Brand 8", "size": 63, "potential": 62, "nonPotential": 38, "key": 192},
{"category": "Brand", "name": "Value for Money Brand 9", "size": 100, "potential": 87, "nonPotential": 13, "key": 233},
{"category": "Brand", "name": "Innovativeness Brand 8", "size": 32, "potential": 66, "nonPotential": 34, "key": 272},
{"category": "Brand", "name": "Innovativeness Brand 19", "size": 1, "potential": 48, "nonPotential": 52, "key": 283},
{"category": "Brand", "name": "Premium Brand 7", "size": 3, "potential": 51, "nonPotential": 49, "key": 291},
{"category": "Brand", "name": "Premium Brand 9", "size": 89, "potential": 91, "nonPotential": 9, "key": 293},
{"category": "Brand", "name": "Premium Brand 14", "size": 24, "potential": 59, "nonPotential": 41, "key": 298}
]
},
{"name": "Content associations", "key": 2,
"children": [
{"category": "Behaviourial", "name": "Vote for Party 2", "size": 10, "potential": 47, "nonPotential": 53, "key": 306},
{"category": "Behaviourial", "name": "Vote for Party 3", "size": 78, "potential": 59, "nonPotential": 41, "key": 307},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 1", "size": 100, "potential": 93, "nonPotential": 7, "key": 310},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 5", "size": 27, "potential": 30, "nonPotential": 70, "key": 314},
{"category": "Behaviourial", "name": "Favourite Evening Activity 2", "size": 8, "potential": 50, "nonPotential": 50, "key": 316},
{"category": "Behaviourial", "name": "Favourite Evening Activity 3", "size": 39, "potential": 71, "nonPotential": 29, "key": 317},
{"category": "Behaviourial", "name": "Shopping Behaviour 4", "size": 94, "potential": 87, "nonPotential": 13, "key": 323},
{"category": "Behaviourial", "name": "Shopping Behaviour 5", "size": 61, "potential": 68, "nonPotential": 32, "key": 324},
{"category": "Behaviourial", "name": "Media Usage 4", "size": 13, "potential": 29, "nonPotential": 71, "key": 328},
{"category": "Behaviourial", "name": "Goals in Life 3", "size": 7, "potential": 51, "nonPotential": 49, "key": 332},
{"category": "Behaviourial", "name": "Goals in Life 4", "size": 83, "potential": 64, "nonPotential": 36, "key": 333},
{"category": "Behaviourial", "name": "Goals in Life 5", "size": 28, "potential": 78, "nonPotential": 22, "key": 334}
]
},
{"name": "Demographic associations", "key": 3,
"children": [
{"category": "Demo", "name": "Age", "size": 100, "potential": 29, "nonPotential": 37, "key": 336},
{"category": "Demo", "name": "Residence", "size": 89, "potential": 58, "nonPotential": 42, "key": 337},
{"category": "Demo", "name": "Children", "size": 43, "potential": 0.4, "nonPotential": 1.2, "key": 338},
{"category": "Demo", "name": "Income", "size": 77, "potential": 29000, "nonPotential": 36000, "key": 339},
{"category": "Demo", "name": "Religion 3", "size": 30, "potential": 59, "nonPotential": 41, "key": 350},
{"category": "Demo", "name": "Area 8", "size": 8, "potential": 51, "nonPotential": 49, "key": 360},
{"category": "Demo", "name": "Ethnicity 5", "size": 49, "potential": 90, "nonPotential": 10, "key": 368},
{"category": "Demo", "name": "Ethnicity 6", "size": 4, "potential": 47, "nonPotential": 53, "key": 369},
{"category": "Demo", "name": "Married: yes", "size": 1, "potential": 38, "nonPotential": 62, "key": 370}
]
},
{"name": "Market associations", "key": 4,
"children": [
{"category": "Market", "name": "Buys Brand 1", "size": 14, "potential": 43, "nonPotential": 57, "key": 372},
{"category": "Market", "name": "Buys Brand 5", "size": 29, "potential": 44, "nonPotential": 56, "key": 376},
{"category": "Market", "name": "Buys Brand 11", "size": 78, "potential": 39, "nonPotential": 61, "key": 382},
{"category": "Market", "name": "Buys Brand 14", "size": 100, "potential": 79, "nonPotential": 21, "key": 385},
{"category": "Market", "name": "Buys Brand 16", "size": 56, "potential": 60, "nonPotential": 40, "key": 387},
{"category": "Market", "name": "Buys Brand 18", "size": 3, "potential": 51, "nonPotential": 49, "key": 389},
{"category": "Market", "name": "Buys Brand 19", "size": 18, "potential": 32, "nonPotential": 68, "key": 390},
{"category": "Market", "name": "Buys Brand 20", "size": 67, "potential": 64, "nonPotential": 36, "key": 391},
{"category": "Market", "name": "Has previously bought Brand 10", "size": 76, "potential": 57, "nonPotential": 43, "key": 401},
{"category": "Market", "name": "Has previously bought Brand 13", "size": 39, "potential": 82, "nonPotential": 18, "key": 404},
{"category": "Market", "name": "Has previously bought Brand 19", "size": 21, "potential": 20, "nonPotential": 80, "key": 410},
{"category": "Market", "name": "Will buy Brand 1", "size": 98, "potential": 53, "nonPotential": 47, "key": 412},
{"category": "Market", "name": "Will buy Brand 2", "size": 3, "potential": 47, "nonPotential": 53, "key": 413},
{"category": "Market", "name": "Will buy Brand 7", "size": 12, "potential": 51, "nonPotential": 49, "key": 418},
{"category": "Market", "name": "Will buy Brand 8", "size": 7, "potential": 53, "nonPotential": 47, "key": 419},
{"category": "Market", "name": "Will buy Brand 12", "size": 46, "potential": 59, "nonPotential": 41, "key": 423},
{"category": "Market", "name": "Will buy Brand 18", "size": 98, "potential": 69, "nonPotential": 31, "key": 429}
]
}
]
}
{
"name": "All Data",
"children": [
{"name": "Brand information", "key": 1,
"children": [
{"category": "Brand", "name": "Top of Mind Awareness Brand 1", "size": 1, "key": 5},
{"category": "Brand", "name": "Top of Mind Awareness Brand 2", "size": 1, "key": 6},
{"category": "Brand", "name": "Top of Mind Awareness Brand 3", "size": 1, "key": 7},
{"category": "Brand", "name": "Top of Mind Awareness Brand 4", "size": 1, "key": 8},
{"category": "Brand", "name": "Top of Mind Awareness Brand 5", "size": 1, "key": 9},
{"category": "Brand", "name": "Top of Mind Awareness Brand 6", "size": 1, "key": 10},
{"category": "Brand", "name": "Top of Mind Awareness Brand 7", "size": 1, "key": 11},
{"category": "Brand", "name": "Top of Mind Awareness Brand 8", "size": 1, "key": 12},
{"category": "Brand", "name": "Top of Mind Awareness Brand 9", "size": 1, "key": 13},
{"category": "Brand", "name": "Top of Mind Awareness Brand 10", "size": 1, "key": 14},
{"category": "Brand", "name": "Top of Mind Awareness Brand 11", "size": 1, "key": 15},
{"category": "Brand", "name": "Top of Mind Awareness Brand 12", "size": 1, "key": 16},
{"category": "Brand", "name": "Top of Mind Awareness Brand 13", "size": 1, "key": 17},
{"category": "Brand", "name": "Top of Mind Awareness Brand 14", "size": 1, "key": 18},
{"category": "Brand", "name": "Top of Mind Awareness Brand 15", "size": 1, "key": 19},
{"category": "Brand", "name": "Top of Mind Awareness Brand 16", "size": 1, "key": 20},
{"category": "Brand", "name": "Top of Mind Awareness Brand 17", "size": 1, "key": 21},
{"category": "Brand", "name": "Top of Mind Awareness Brand 18", "size": 1, "key": 22},
{"category": "Brand", "name": "Top of Mind Awareness Brand 19", "size": 1, "key": 23},
{"category": "Brand", "name": "Top of Mind Awareness Brand 20", "size": 1, "key": 24},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 1", "size": 1, "key": 25},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 2", "size": 1, "key": 26},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 3", "size": 1, "key": 27},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 4", "size": 1, "key": 28},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 5", "size": 1, "key": 29},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 6", "size": 1, "key": 30},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 7", "size": 1, "key": 31},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 8", "size": 1, "key": 32},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 9", "size": 1, "key": 33},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 10", "size": 1, "key": 34},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 11", "size": 1, "key": 35},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 12", "size": 1, "key": 36},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 13", "size": 1, "key": 37},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 14", "size": 1, "key": 38},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 15", "size": 1, "key": 39},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 16", "size": 1, "key": 40},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 17", "size": 1, "key": 41},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 18", "size": 1, "key": 42},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 19", "size": 1, "key": 43},
{"category": "Brand", "name": "Top of Mind Ad Awareness Brand 20", "size": 1, "key": 44},
{"category": "Brand", "name": "Unaided Awareness Brand 1", "size": 1, "key": 45},
{"category": "Brand", "name": "Unaided Awareness Brand 2", "size": 1, "key": 46},
{"category": "Brand", "name": "Unaided Awareness Brand 3", "size": 1, "key": 47},
{"category": "Brand", "name": "Unaided Awareness Brand 4", "size": 1, "key": 48},
{"category": "Brand", "name": "Unaided Awareness Brand 5", "size": 1, "key": 49},
{"category": "Brand", "name": "Unaided Awareness Brand 6", "size": 1, "key": 50},
{"category": "Brand", "name": "Unaided Awareness Brand 7", "size": 1, "key": 51},
{"category": "Brand", "name": "Unaided Awareness Brand 8", "size": 1, "key": 52},
{"category": "Brand", "name": "Unaided Awareness Brand 9", "size": 1, "key": 53},
{"category": "Brand", "name": "Unaided Awareness Brand 10", "size": 1, "key": 54},
{"category": "Brand", "name": "Unaided Awareness Brand 11", "size": 1, "key": 55},
{"category": "Brand", "name": "Unaided Awareness Brand 12", "size": 1, "key": 56},
{"category": "Brand", "name": "Unaided Awareness Brand 13", "size": 1, "key": 57},
{"category": "Brand", "name": "Unaided Awareness Brand 14", "size": 1, "key": 58},
{"category": "Brand", "name": "Unaided Awareness Brand 15", "size": 1, "key": 59},
{"category": "Brand", "name": "Unaided Awareness Brand 16", "size": 1, "key": 60},
{"category": "Brand", "name": "Unaided Awareness Brand 17", "size": 1, "key": 61},
{"category": "Brand", "name": "Unaided Awareness Brand 18", "size": 1, "key": 62},
{"category": "Brand", "name": "Unaided Awareness Brand 19", "size": 1, "key": 63},
{"category": "Brand", "name": "Unaided Awareness Brand 20", "size": 1, "key": 64},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 1", "size": 1, "key": 65},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 2", "size": 1, "key": 66},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 3", "size": 1, "key": 67},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 4", "size": 1, "key": 68},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 5", "size": 1, "key": 69},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 6", "size": 1, "key": 70},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 7", "size": 1, "key": 71},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 8", "size": 1, "key": 72},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 9", "size": 1, "key": 73},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 10", "size": 1, "key": 74},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 11", "size": 1, "key": 75},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 12", "size": 1, "key": 76},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 13", "size": 1, "key": 77},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 14", "size": 1, "key": 78},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 15", "size": 1, "key": 79},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 16", "size": 1, "key": 80},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 17", "size": 1, "key": 81},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 18", "size": 1, "key": 82},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 19", "size": 1, "key": 83},
{"category": "Brand", "name": "Unaided Ad Awareness Brand 20", "size": 1, "key": 84},
{"category": "Brand", "name": "Aided Awareness Brand 1", "size": 1, "key": 85},
{"category": "Brand", "name": "Aided Awareness Brand 2", "size": 1, "key": 86},
{"category": "Brand", "name": "Aided Awareness Brand 3", "size": 1, "key": 87},
{"category": "Brand", "name": "Aided Awareness Brand 4", "size": 1, "key": 88},
{"category": "Brand", "name": "Aided Awareness Brand 5", "size": 1, "key": 89},
{"category": "Brand", "name": "Aided Awareness Brand 6", "size": 1, "key": 90},
{"category": "Brand", "name": "Aided Awareness Brand 7", "size": 1, "key": 91},
{"category": "Brand", "name": "Aided Awareness Brand 8", "size": 1, "key": 92},
{"category": "Brand", "name": "Aided Awareness Brand 9", "size": 1, "key": 93},
{"category": "Brand", "name": "Aided Awareness Brand 10", "size": 1, "key": 94},
{"category": "Brand", "name": "Aided Awareness Brand 11", "size": 1, "key": 95},
{"category": "Brand", "name": "Aided Awareness Brand 12", "size": 1, "key": 96},
{"category": "Brand", "name": "Aided Awareness Brand 13", "size": 1, "key": 97},
{"category": "Brand", "name": "Aided Awareness Brand 14", "size": 1, "key": 98},
{"category": "Brand", "name": "Aided Awareness Brand 15", "size": 1, "key": 99},
{"category": "Brand", "name": "Aided Awareness Brand 16", "size": 1, "key": 100},
{"category": "Brand", "name": "Aided Awareness Brand 17", "size": 1, "key": 101},
{"category": "Brand", "name": "Aided Awareness Brand 18", "size": 1, "key": 102},
{"category": "Brand", "name": "Aided Awareness Brand 19", "size": 1, "key": 103},
{"category": "Brand", "name": "Aided Awareness Brand 20", "size": 1, "key": 104},
{"category": "Brand", "name": "Consideration to buy Brand 1", "size": 1, "key": 105},
{"category": "Brand", "name": "Consideration to buy Brand 2", "size": 1, "key": 106},
{"category": "Brand", "name": "Consideration to buy Brand 3", "size": 1, "key": 107},
{"category": "Brand", "name": "Consideration to buy Brand 4", "size": 1, "key": 108},
{"category": "Brand", "name": "Consideration to buy Brand 5", "size": 1, "key": 109},
{"category": "Brand", "name": "Consideration to buy Brand 6", "size": 1, "key": 110},
{"category": "Brand", "name": "Consideration to buy Brand 7", "size": 1, "key": 111},
{"category": "Brand", "name": "Consideration to buy Brand 8", "size": 1, "key": 112},
{"category": "Brand", "name": "Consideration to buy Brand 9", "size": 1, "key": 113},
{"category": "Brand", "name": "Consideration to buy Brand 10", "size": 1, "key": 114},
{"category": "Brand", "name": "Consideration to buy Brand 11", "size": 1, "key": 115},
{"category": "Brand", "name": "Consideration to buy Brand 12", "size": 1, "key": 116},
{"category": "Brand", "name": "Consideration to buy Brand 13", "size": 1, "key": 117},
{"category": "Brand", "name": "Consideration to buy Brand 14", "size": 1, "key": 118},
{"category": "Brand", "name": "Consideration to buy Brand 15", "size": 1, "key": 119},
{"category": "Brand", "name": "Consideration to buy Brand 16", "size": 1, "key": 120},
{"category": "Brand", "name": "Consideration to buy Brand 17", "size": 1, "key": 121},
{"category": "Brand", "name": "Consideration to buy Brand 18", "size": 1, "key": 122},
{"category": "Brand", "name": "Consideration to buy Brand 19", "size": 1, "key": 123},
{"category": "Brand", "name": "Consideration to buy Brand 20", "size": 1, "key": 124},
{"category": "Brand", "name": "Preference Brand 1", "size": 1, "key": 125},
{"category": "Brand", "name": "Preference Brand 2", "size": 1, "key": 126},
{"category": "Brand", "name": "Preference Brand 3", "size": 1, "key": 127},
{"category": "Brand", "name": "Preference Brand 4", "size": 1, "key": 128},
{"category": "Brand", "name": "Preference Brand 5", "size": 1, "key": 129},
{"category": "Brand", "name": "Preference Brand 6", "size": 1, "key": 130},
{"category": "Brand", "name": "Preference Brand 7", "size": 1, "key": 131},
{"category": "Brand", "name": "Preference Brand 8", "size": 1, "key": 132},
{"category": "Brand", "name": "Preference Brand 9", "size": 1, "key": 133},
{"category": "Brand", "name": "Preference Brand 10", "size": 1, "key": 134},
{"category": "Brand", "name": "Preference Brand 11", "size": 1, "key": 135},
{"category": "Brand", "name": "Preference Brand 12", "size": 1, "key": 136},
{"category": "Brand", "name": "Preference Brand 13", "size": 1, "key": 137},
{"category": "Brand", "name": "Preference Brand 14", "size": 1, "key": 138},
{"category": "Brand", "name": "Preference Brand 15", "size": 1, "key": 139},
{"category": "Brand", "name": "Preference Brand 16", "size": 1, "key": 140},
{"category": "Brand", "name": "Preference Brand 17", "size": 1, "key": 141},
{"category": "Brand", "name": "Preference Brand 18", "size": 1, "key": 142},
{"category": "Brand", "name": "Preference Brand 19", "size": 1, "key": 143},
{"category": "Brand", "name": "Preference Brand 20", "size": 1, "key": 144},
{"category": "Brand", "name": "Equity Brand 1", "size": 1, "key": 145},
{"category": "Brand", "name": "Equity Brand 2", "size": 1, "key": 146},
{"category": "Brand", "name": "Equity Brand 3", "size": 1, "key": 147},
{"category": "Brand", "name": "Equity Brand 4", "size": 1, "key": 148},
{"category": "Brand", "name": "Equity Brand 5", "size": 1, "key": 149},
{"category": "Brand", "name": "Equity Brand 6", "size": 1, "key": 150},
{"category": "Brand", "name": "Equity Brand 7", "size": 1, "key": 151},
{"category": "Brand", "name": "Equity Brand 8", "size": 1, "key": 152},
{"category": "Brand", "name": "Equity Brand 9", "size": 1, "key": 153},
{"category": "Brand", "name": "Equity Brand 10", "size": 1, "key": 154},
{"category": "Brand", "name": "Equity Brand 11", "size": 1, "key": 155},
{"category": "Brand", "name": "Equity Brand 12", "size": 1, "key": 156},
{"category": "Brand", "name": "Equity Brand 13", "size": 1, "key": 157},
{"category": "Brand", "name": "Equity Brand 14", "size": 1, "key": 158},
{"category": "Brand", "name": "Equity Brand 15", "size": 1, "key": 159},
{"category": "Brand", "name": "Equity Brand 16", "size": 1, "key": 160},
{"category": "Brand", "name": "Equity Brand 17", "size": 1, "key": 161},
{"category": "Brand", "name": "Equity Brand 18", "size": 1, "key": 162},
{"category": "Brand", "name": "Equity Brand 19", "size": 1, "key": 163},
{"category": "Brand", "name": "Equity Brand 20", "size": 1, "key": 164},
{"category": "Brand", "name": "Rejection Brand 1", "size": 1, "key": 165},
{"category": "Brand", "name": "Rejection Brand 2", "size": 1, "key": 166},
{"category": "Brand", "name": "Rejection Brand 3", "size": 1, "key": 167},
{"category": "Brand", "name": "Rejection Brand 4", "size": 1, "key": 168},
{"category": "Brand", "name": "Rejection Brand 5", "size": 1, "key": 169},
{"category": "Brand", "name": "Rejection Brand 6", "size": 1, "key": 170},
{"category": "Brand", "name": "Rejection Brand 7", "size": 1, "key": 171},
{"category": "Brand", "name": "Rejection Brand 8", "size": 1, "key": 172},
{"category": "Brand", "name": "Rejection Brand 9", "size": 1, "key": 173},
{"category": "Brand", "name": "Rejection Brand 10", "size": 1, "key": 174},
{"category": "Brand", "name": "Rejection Brand 11", "size": 1, "key": 175},
{"category": "Brand", "name": "Rejection Brand 12", "size": 1, "key": 176},
{"category": "Brand", "name": "Rejection Brand 13", "size": 1, "key": 177},
{"category": "Brand", "name": "Rejection Brand 14", "size": 1, "key": 178},
{"category": "Brand", "name": "Rejection Brand 15", "size": 1, "key": 179},
{"category": "Brand", "name": "Rejection Brand 16", "size": 1, "key": 180},
{"category": "Brand", "name": "Rejection Brand 17", "size": 1, "key": 181},
{"category": "Brand", "name": "Rejection Brand 18", "size": 1, "key": 182},
{"category": "Brand", "name": "Rejection Brand 19", "size": 1, "key": 183},
{"category": "Brand", "name": "Rejection Brand 20", "size": 1, "key": 184},
{"category": "Brand", "name": "Recommendation Brand 1", "size": 1, "key": 185},
{"category": "Brand", "name": "Recommendation Brand 2", "size": 1, "key": 186},
{"category": "Brand", "name": "Recommendation Brand 3", "size": 1, "key": 187},
{"category": "Brand", "name": "Recommendation Brand 4", "size": 1, "key": 188},
{"category": "Brand", "name": "Recommendation Brand 5", "size": 1, "key": 189},
{"category": "Brand", "name": "Recommendation Brand 6", "size": 1, "key": 190},
{"category": "Brand", "name": "Recommendation Brand 7", "size": 1, "key": 191},
{"category": "Brand", "name": "Recommendation Brand 8", "size": 1, "key": 192},
{"category": "Brand", "name": "Recommendation Brand 9", "size": 1, "key": 193},
{"category": "Brand", "name": "Recommendation Brand 10", "size": 1, "key": 194},
{"category": "Brand", "name": "Recommendation Brand 11", "size": 1, "key": 195},
{"category": "Brand", "name": "Recommendation Brand 12", "size": 1, "key": 196},
{"category": "Brand", "name": "Recommendation Brand 13", "size": 1, "key": 197},
{"category": "Brand", "name": "Recommendation Brand 14", "size": 1, "key": 198},
{"category": "Brand", "name": "Recommendation Brand 15", "size": 1, "key": 199},
{"category": "Brand", "name": "Recommendation Brand 16", "size": 1, "key": 200},
{"category": "Brand", "name": "Recommendation Brand 17", "size": 1, "key": 201},
{"category": "Brand", "name": "Recommendation Brand 18", "size": 1, "key": 202},
{"category": "Brand", "name": "Recommendation Brand 19", "size": 1, "key": 203},
{"category": "Brand", "name": "Recommendation Brand 20", "size": 1, "key": 204},
{"category": "Brand", "name": "Satisfaction Brand 1", "size": 1, "key": 205},
{"category": "Brand", "name": "Satisfaction Brand 2", "size": 1, "key": 206},
{"category": "Brand", "name": "Satisfaction Brand 3", "size": 1, "key": 207},
{"category": "Brand", "name": "Satisfaction Brand 4", "size": 1, "key": 208},
{"category": "Brand", "name": "Satisfaction Brand 5", "size": 1, "key": 209},
{"category": "Brand", "name": "Satisfaction Brand 6", "size": 1, "key": 210},
{"category": "Brand", "name": "Satisfaction Brand 7", "size": 1, "key": 211},
{"category": "Brand", "name": "Satisfaction Brand 8", "size": 1, "key": 212},
{"category": "Brand", "name": "Satisfaction Brand 9", "size": 1, "key": 213},
{"category": "Brand", "name": "Satisfaction Brand 10", "size": 1, "key": 214},
{"category": "Brand", "name": "Satisfaction Brand 11", "size": 1, "key": 215},
{"category": "Brand", "name": "Satisfaction Brand 12", "size": 1, "key": 216},
{"category": "Brand", "name": "Satisfaction Brand 13", "size": 1, "key": 217},
{"category": "Brand", "name": "Satisfaction Brand 14", "size": 1, "key": 218},
{"category": "Brand", "name": "Satisfaction Brand 15", "size": 1, "key": 219},
{"category": "Brand", "name": "Satisfaction Brand 16", "size": 1, "key": 220},
{"category": "Brand", "name": "Satisfaction Brand 17", "size": 1, "key": 221},
{"category": "Brand", "name": "Satisfaction Brand 18", "size": 1, "key": 222},
{"category": "Brand", "name": "Satisfaction Brand 19", "size": 1, "key": 223},
{"category": "Brand", "name": "Satisfaction Brand 20", "size": 1, "key": 224},
{"category": "Brand", "name": "Value for Money Brand 1", "size": 1, "key": 225},
{"category": "Brand", "name": "Value for Money Brand 2", "size": 1, "key": 226},
{"category": "Brand", "name": "Value for Money Brand 3", "size": 1, "key": 227},
{"category": "Brand", "name": "Value for Money Brand 4", "size": 1, "key": 228},
{"category": "Brand", "name": "Value for Money Brand 5", "size": 1, "key": 229},
{"category": "Brand", "name": "Value for Money Brand 6", "size": 1, "key": 230},
{"category": "Brand", "name": "Value for Money Brand 7", "size": 1, "key": 231},
{"category": "Brand", "name": "Value for Money Brand 8", "size": 1, "key": 232},
{"category": "Brand", "name": "Value for Money Brand 9", "size": 1, "key": 233},
{"category": "Brand", "name": "Value for Money Brand 10", "size": 1, "key": 234},
{"category": "Brand", "name": "Value for Money Brand 11", "size": 1, "key": 235},
{"category": "Brand", "name": "Value for Money Brand 12", "size": 1, "key": 236},
{"category": "Brand", "name": "Value for Money Brand 13", "size": 1, "key": 237},
{"category": "Brand", "name": "Value for Money Brand 14", "size": 1, "key": 238},
{"category": "Brand", "name": "Value for Money Brand 15", "size": 1, "key": 239},
{"category": "Brand", "name": "Value for Money Brand 16", "size": 1, "key": 240},
{"category": "Brand", "name": "Value for Money Brand 17", "size": 1, "key": 241},
{"category": "Brand", "name": "Value for Money Brand 18", "size": 1, "key": 242},
{"category": "Brand", "name": "Value for Money Brand 19", "size": 1, "key": 243},
{"category": "Brand", "name": "Value for Money Brand 20", "size": 1, "key": 244},
{"category": "Brand", "name": "Trustorthiness Brand 1", "size": 1, "key": 245},
{"category": "Brand", "name": "Trustorthiness Brand 2", "size": 1, "key": 246},
{"category": "Brand", "name": "Trustorthiness Brand 3", "size": 1, "key": 247},
{"category": "Brand", "name": "Trustorthiness Brand 4", "size": 1, "key": 248},
{"category": "Brand", "name": "Trustorthiness Brand 5", "size": 1, "key": 249},
{"category": "Brand", "name": "Trustorthiness Brand 6", "size": 1, "key": 250},
{"category": "Brand", "name": "Trustorthiness Brand 7", "size": 1, "key": 251},
{"category": "Brand", "name": "Trustorthiness Brand 8", "size": 1, "key": 252},
{"category": "Brand", "name": "Trustorthiness Brand 9", "size": 1, "key": 253},
{"category": "Brand", "name": "Trustorthiness Brand 10", "size": 1, "key": 254},
{"category": "Brand", "name": "Trustorthiness Brand 11", "size": 1, "key": 255},
{"category": "Brand", "name": "Trustorthiness Brand 12", "size": 1, "key": 256},
{"category": "Brand", "name": "Trustorthiness Brand 13", "size": 1, "key": 257},
{"category": "Brand", "name": "Trustorthiness Brand 14", "size": 1, "key": 258},
{"category": "Brand", "name": "Trustorthiness Brand 15", "size": 1, "key": 259},
{"category": "Brand", "name": "Trustorthiness Brand 16", "size": 1, "key": 260},
{"category": "Brand", "name": "Trustorthiness Brand 17", "size": 1, "key": 261},
{"category": "Brand", "name": "Trustorthiness Brand 18", "size": 1, "key": 262},
{"category": "Brand", "name": "Trustorthiness Brand 19", "size": 1, "key": 263},
{"category": "Brand", "name": "Trustorthiness Brand 20", "size": 1, "key": 264},
{"category": "Brand", "name": "Innovativeness Brand 1", "size": 1, "key": 265},
{"category": "Brand", "name": "Innovativeness Brand 2", "size": 1, "key": 266},
{"category": "Brand", "name": "Innovativeness Brand 3", "size": 1, "key": 267},
{"category": "Brand", "name": "Innovativeness Brand 4", "size": 1, "key": 268},
{"category": "Brand", "name": "Innovativeness Brand 5", "size": 1, "key": 269},
{"category": "Brand", "name": "Innovativeness Brand 6", "size": 1, "key": 270},
{"category": "Brand", "name": "Innovativeness Brand 7", "size": 1, "key": 271},
{"category": "Brand", "name": "Innovativeness Brand 8", "size": 1, "key": 272},
{"category": "Brand", "name": "Innovativeness Brand 9", "size": 1, "key": 273},
{"category": "Brand", "name": "Innovativeness Brand 10", "size": 1, "key": 274},
{"category": "Brand", "name": "Innovativeness Brand 11", "size": 1, "key": 275},
{"category": "Brand", "name": "Innovativeness Brand 12", "size": 1, "key": 276},
{"category": "Brand", "name": "Innovativeness Brand 13", "size": 1, "key": 277},
{"category": "Brand", "name": "Innovativeness Brand 14", "size": 1, "key": 278},
{"category": "Brand", "name": "Innovativeness Brand 15", "size": 1, "key": 279},
{"category": "Brand", "name": "Innovativeness Brand 16", "size": 1, "key": 280},
{"category": "Brand", "name": "Innovativeness Brand 17", "size": 1, "key": 281},
{"category": "Brand", "name": "Innovativeness Brand 18", "size": 1, "key": 282},
{"category": "Brand", "name": "Innovativeness Brand 19", "size": 1, "key": 283},
{"category": "Brand", "name": "Innovativeness Brand 20", "size": 1, "key": 284},
{"category": "Brand", "name": "Premium Brand 1", "size": 1, "key": 285},
{"category": "Brand", "name": "Premium Brand 2", "size": 1, "key": 286},
{"category": "Brand", "name": "Premium Brand 3", "size": 1, "key": 287},
{"category": "Brand", "name": "Premium Brand 4", "size": 1, "key": 288},
{"category": "Brand", "name": "Premium Brand 5", "size": 1, "key": 289},
{"category": "Brand", "name": "Premium Brand 6", "size": 1, "key": 290},
{"category": "Brand", "name": "Premium Brand 7", "size": 1, "key": 291},
{"category": "Brand", "name": "Premium Brand 8", "size": 1, "key": 292},
{"category": "Brand", "name": "Premium Brand 9", "size": 1, "key": 293},
{"category": "Brand", "name": "Premium Brand 10", "size": 1, "key": 294},
{"category": "Brand", "name": "Premium Brand 11", "size": 1, "key": 295},
{"category": "Brand", "name": "Premium Brand 12", "size": 1, "key": 296},
{"category": "Brand", "name": "Premium Brand 13", "size": 1, "key": 297},
{"category": "Brand", "name": "Premium Brand 14", "size": 1, "key": 298},
{"category": "Brand", "name": "Premium Brand 15", "size": 1, "key": 299},
{"category": "Brand", "name": "Premium Brand 16", "size": 1, "key": 300},
{"category": "Brand", "name": "Premium Brand 17", "size": 1, "key": 301},
{"category": "Brand", "name": "Premium Brand 18", "size": 1, "key": 302},
{"category": "Brand", "name": "Premium Brand 19", "size": 1, "key": 303},
{"category": "Brand", "name": "Premium Brand 20", "size": 1, "key": 304}
]
},
{"name": "Content information", "key": 2,
"children": [
{"category": "Behaviourial", "name": "Vote for Party 1", "size": 1, "key": 305},
{"category": "Behaviourial", "name": "Vote for Party 2", "size": 1, "key": 306},
{"category": "Behaviourial", "name": "Vote for Party 3", "size": 1, "key": 307},
{"category": "Behaviourial", "name": "Vote for Party 4", "size": 1, "key": 308},
{"category": "Behaviourial", "name": "Vote for Party 5", "size": 1, "key": 309},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 1", "size": 1, "key": 310},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 2", "size": 1, "key": 311},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 3", "size": 1, "key": 312},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 4", "size": 1, "key": 313},
{"category": "Behaviourial", "name": "Favourite Daytime Activity 5", "size": 1, "key": 314},
{"category": "Behaviourial", "name": "Favourite Evening Activity 1", "size": 1, "key": 315},
{"category": "Behaviourial", "name": "Favourite Evening Activity 2", "size": 1, "key": 316},
{"category": "Behaviourial", "name": "Favourite Evening Activity 3", "size": 1, "key": 317},
{"category": "Behaviourial", "name": "Favourite Evening Activity 4", "size": 1, "key": 318},
{"category": "Behaviourial", "name": "Favourite Evening Activity 5", "size": 1, "key": 319},
{"category": "Behaviourial", "name": "Shopping Behaviour 1", "size": 1, "key": 320},
{"category": "Behaviourial", "name": "Shopping Behaviour 2", "size": 1, "key": 321},
{"category": "Behaviourial", "name": "Shopping Behaviour 3", "size": 1, "key": 322},
{"category": "Behaviourial", "name": "Shopping Behaviour 4", "size": 1, "key": 323},
{"category": "Behaviourial", "name": "Shopping Behaviour 5", "size": 1, "key": 324},
{"category": "Behaviourial", "name": "Media Usage 1", "size": 1, "key": 325},
{"category": "Behaviourial", "name": "Media Usage 2", "size": 1, "key": 326},
{"category": "Behaviourial", "name": "Media Usage 3", "size": 1, "key": 327},
{"category": "Behaviourial", "name": "Media Usage 4", "size": 1, "key": 328},
{"category": "Behaviourial", "name": "Media Usage 5", "size": 1, "key": 329},
{"category": "Behaviourial", "name": "Goals in Life 1", "size": 1, "key": 330},
{"category": "Behaviourial", "name": "Goals in Life 2", "size": 1, "key": 331},
{"category": "Behaviourial", "name": "Goals in Life 3", "size": 1, "key": 332},
{"category": "Behaviourial", "name": "Goals in Life 4", "size": 1, "key": 333},
{"category": "Behaviourial", "name": "Goals in Life 5", "size": 1, "key": 334}
]
},
{"name": "Demographic information", "key": 3,
"children": [
{"category": "Demo", "name": "Gender", "size": 1, "key": 335},
{"category": "Demo", "name": "Age", "size": 1, "key": 336},
{"category": "Demo", "name": "Residence", "size": 1, "key": 337},
{"category": "Demo", "name": "Children", "size": 1, "key": 338},
{"category": "Demo", "name": "Income", "size": 1, "key": 339},
{"category": "Demo", "name": "HH Size > 3", "size": 1, "key": 340},
{"category": "Demo", "name": "Education 1", "size": 1, "key": 341},
{"category": "Demo", "name": "Education 2", "size": 1, "key": 342},
{"category": "Demo", "name": "Education 3", "size": 1, "key": 343},
{"category": "Demo", "name": "Education 4", "size": 1, "key": 344},
{"category": "Demo", "name": "Education 5", "size": 1, "key": 345},
{"category": "Demo", "name": "Education 6", "size": 1, "key": 346},
{"category": "Demo", "name": "Education 7", "size": 1, "key": 347},
{"category": "Demo", "name": "Religion 1", "size": 1, "key": 348},
{"category": "Demo", "name": "Religion 2", "size": 1, "key": 349},
{"category": "Demo", "name": "Religion 3", "size": 1, "key": 350},
{"category": "Demo", "name": "Religion 4", "size": 1, "key": 351},
{"category": "Demo", "name": "Religion 5", "size": 1, "key": 352},
{"category": "Demo", "name": "Area 1", "size": 1, "key": 353},
{"category": "Demo", "name": "Area 2", "size": 1, "key": 354},
{"category": "Demo", "name": "Area 3", "size": 1, "key": 355},
{"category": "Demo", "name": "Area 4", "size": 1, "key": 356},
{"category": "Demo", "name": "Area 5", "size": 1, "key": 357},
{"category": "Demo", "name": "Area 6", "size": 1, "key": 358},
{"category": "Demo", "name": "Area 7", "size": 1, "key": 359},
{"category": "Demo", "name": "Area 8", "size": 1, "key": 360},
{"category": "Demo", "name": "Area 9", "size": 1, "key": 361},
{"category": "Demo", "name": "Area 10", "size": 1, "key": 362},
{"category": "Demo", "name": "Area 11", "size": 1, "key": 363},
{"category": "Demo", "name": "Ethnicity 1", "size": 1, "key": 364},
{"category": "Demo", "name": "Ethnicity 2", "size": 1, "key": 365},
{"category": "Demo", "name": "Ethnicity 3", "size": 1, "key": 366},
{"category": "Demo", "name": "Ethnicity 4", "size": 1, "key": 367},
{"category": "Demo", "name": "Ethnicity 5", "size": 1, "key": 368},
{"category": "Demo", "name": "Ethnicity 6", "size": 1, "key": 369},
{"category": "Demo", "name": "Married: yes", "size": 1, "key": 370},
{"category": "Demo", "name": "Employed: yes", "size": 1, "key": 371}
]
},
{"name": "Market information", "key": 4,
"children": [
{"category": "Market", "name": "Buys Brand 1", "size": 1, "key": 372},
{"category": "Market", "name": "Buys Brand 2", "size": 1, "key": 373},
{"category": "Market", "name": "Buys Brand 3", "size": 1, "key": 374},
{"category": "Market", "name": "Buys Brand 4", "size": 1, "key": 375},
{"category": "Market", "name": "Buys Brand 5", "size": 1, "key": 376},
{"category": "Market", "name": "Buys Brand 6", "size": 1, "key": 377},
{"category": "Market", "name": "Buys Brand 7", "size": 1, "key": 378},
{"category": "Market", "name": "Buys Brand 8", "size": 1, "key": 379},
{"category": "Market", "name": "Buys Brand 9", "size": 1, "key": 380},
{"category": "Market", "name": "Buys Brand 10", "size": 1, "key": 381},
{"category": "Market", "name": "Buys Brand 11", "size": 1, "key": 382},
{"category": "Market", "name": "Buys Brand 12", "size": 1, "key": 383},
{"category": "Market", "name": "Buys Brand 13", "size": 1, "key": 384},
{"category": "Market", "name": "Buys Brand 14", "size": 1, "key": 385},
{"category": "Market", "name": "Buys Brand 15", "size": 1, "key": 386},
{"category": "Market", "name": "Buys Brand 16", "size": 1, "key": 387},
{"category": "Market", "name": "Buys Brand 17", "size": 1, "key": 388},
{"category": "Market", "name": "Buys Brand 18", "size": 1, "key": 389},
{"category": "Market", "name": "Buys Brand 19", "size": 1, "key": 390},
{"category": "Market", "name": "Buys Brand 20", "size": 1, "key": 391},
{"category": "Market", "name": "Has previously bought Brand 1", "size": 1, "key": 392},
{"category": "Market", "name": "Has previously bought Brand 2", "size": 1, "key": 393},
{"category": "Market", "name": "Has previously bought Brand 3", "size": 1, "key": 394},
{"category": "Market", "name": "Has previously bought Brand 4", "size": 1, "key": 395},
{"category": "Market", "name": "Has previously bought Brand 5", "size": 1, "key": 396},
{"category": "Market", "name": "Has previously bought Brand 6", "size": 1, "key": 397},
{"category": "Market", "name": "Has previously bought Brand 7", "size": 1, "key": 398},
{"category": "Market", "name": "Has previously bought Brand 8", "size": 1, "key": 399},
{"category": "Market", "name": "Has previously bought Brand 9", "size": 1, "key": 400},
{"category": "Market", "name": "Has previously bought Brand 10", "size": 1, "key": 401},
{"category": "Market", "name": "Has previously bought Brand 11", "size": 1, "key": 402},
{"category": "Market", "name": "Has previously bought Brand 12", "size": 1, "key": 403},
{"category": "Market", "name": "Has previously bought Brand 13", "size": 1, "key": 404},
{"category": "Market", "name": "Has previously bought Brand 14", "size": 1, "key": 405},
{"category": "Market", "name": "Has previously bought Brand 15", "size": 1, "key": 406},
{"category": "Market", "name": "Has previously bought Brand 16", "size": 1, "key": 407},
{"category": "Market", "name": "Has previously bought Brand 17", "size": 1, "key": 408},
{"category": "Market", "name": "Has previously bought Brand 18", "size": 1, "key": 409},
{"category": "Market", "name": "Has previously bought Brand 19", "size": 1, "key": 410},
{"category": "Market", "name": "Has previously bought Brand 20", "size": 1, "key": 411},
{"category": "Market", "name": "Will buy Brand 1", "size": 1, "key": 412},
{"category": "Market", "name": "Will buy Brand 2", "size": 1, "key": 413},
{"category": "Market", "name": "Will buy Brand 3", "size": 1, "key": 414},
{"category": "Market", "name": "Will buy Brand 4", "size": 1, "key": 415},
{"category": "Market", "name": "Will buy Brand 5", "size": 1, "key": 416},
{"category": "Market", "name": "Will buy Brand 6", "size": 1, "key": 417},
{"category": "Market", "name": "Will buy Brand 7", "size": 1, "key": 418},
{"category": "Market", "name": "Will buy Brand 8", "size": 1, "key": 419},
{"category": "Market", "name": "Will buy Brand 9", "size": 1, "key": 420},
{"category": "Market", "name": "Will buy Brand 10", "size": 1, "key": 421},
{"category": "Market", "name": "Will buy Brand 11", "size": 1, "key": 422},
{"category": "Market", "name": "Will buy Brand 12", "size": 1, "key": 423},
{"category": "Market", "name": "Will buy Brand 13", "size": 1, "key": 424},
{"category": "Market", "name": "Will buy Brand 14", "size": 1, "key": 425},
{"category": "Market", "name": "Will buy Brand 15", "size": 1, "key": 426},
{"category": "Market", "name": "Will buy Brand 16", "size": 1, "key": 427},
{"category": "Market", "name": "Will buy Brand 17", "size": 1, "key": 428},
{"category": "Market", "name": "Will buy Brand 18", "size": 1, "key": 429},
{"category": "Market", "name": "Will buy Brand 19", "size": 1, "key": 430},
{"category": "Market", "name": "Will buy Brand 20", "size": 1, "key": 431}
]
}
]
}
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Lato">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Circle Pack to show Model-Inference</title>
</head>
<body>
<div id="header">
<h1>Transforming Information with a predictive model :<span style="color:#6C7A89">&nbsp;identifying key predictors</span></h1>
<p>See how a predictive model can "excavate" important characteristics about
a (target)group of choice.
Use the two buttons to the left to compare pre- and post-model predictor-importance.</p>
<p>Compare individual paramater distribution of the two response classes
by slecting the predictors of interest. (pls open in new window for full view)</p>
</div>
<div class="container">
<div class="buttonWrapper">
<div class="buttonWrapper1">
<p class="button" id="button1">No model applied</br> <span style="font-size:10px;">All available neutral information</span></p>
</div>
<div class="buttonWrapper2">
<p class="button" id="button2">Apply model</br> <span style="font-size:10px;">Model-picked &amp; weighted associations</span></p>
</div>
</div>
<div class="svgRightWrapper"></div>
<div id="reloadPage" onClick="window.location.reload()">Start afresh</div>
</div>
<script src="script.js"></script>
</body>
</html>
// set up constants and containers
var diameter = 850,
format = d3.format(",d");
var pack = d3.layout.pack()
.size([diameter - 30, diameter - 30])
.value(function(d) { return d.size; })
.padding(5);
var svg = d3.select(".container").append("svg")
.attr("width", diameter)
.attr("height", diameter)
.append("g")
.attr("transform", "translate(20,10)");
var tip = d3.select("body").append("div")
.attr("class", "tooltip")
.style("opacity", 0);
// get data
var currentJson;
var dataSet;
var getNewData1 = function() {
currentUrl = "dataPreModel.json";
d3.json(currentUrl, function(error, data) {
currentJson = data;
dataSet = 1;
refresh();
});
}
var getNewData2 = function() {
currentUrl = "dataPostModel.json";
d3.json(currentUrl, function(error, data) {
currentJson = data;
dataSet = 2;
refresh();
});
}
// draw function
var refresh = function() {
var dur = 4000;
var colorScaleTest = d3.scale.ordinal()
.domain([d3.map(currentJson.children)])
.range(["#fc8d62","#66c2a5","#8da0cb","#feb24c"]);
// 1 Market 2 Brand 3 Content 4 Demo
var node = svg.selectAll(".node")
.data(pack.nodes(currentJson), function(d) { return d.key; });
// data_importance data joined with all g elements
// including a key function (using the identity function (d)) makes sure the same circles get transitioned
var enter = node.enter().append("g")
.attr("class", function(d) { return d.children ? "node" : "leaf node"; })
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; })
d3.select("#button1").on("click", getNewData1);
d3.select("#button2").on("click", getNewData2);
var circles = enter.append("circle")
.attr("r", 0)
.transition() // trans.-attributes set by below upd.-sel
.attr("r", function(d) { return d.r; });
// entered and transition circles r
// set delay for staggered object constancy only for transition from constant to importance dataset (too slow for the other direction)
if(dataSet == 2) {
node.transition()
.delay( function(d,i) { return i * 20; })
.duration(dur / 3)
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
// update circles x/y positions
} else {
node.transition()
.duration(dur / 3)
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
// update circles x/y positions
}
node.select("circle")
.transition()
.duration(dur)
.attr("fill", function(d) { return !d.children ? colorScaleTest(d.category) : "#BFBFBF"; })
.attr("stroke-width", function(d) { return !d.children ? 0 : 2; })
.attr("stroke", "#999")
.attr("opacity", function(d) { return !d.children ? 1 : 0.25; })
.attr("r", function(d) { return d.r; });
// update circles radius
var labels = enter.filter(function(d) { return !d.children; }).append("text")
.attr("dy", ".3em")
.style("text-anchor", "middle")
.text(function(d) { return d.name.substring(0, d.r / 3); });
// enter labels
node.selectAll("text").style("font-size", 0);
node.filter(function(d) { return !d.children; }).select("text")
.transition()
.delay(dur)
.attr("dy", ".3em")
.style("text-anchor", "middle")
.style("font-size", 10) // required alongside the ugly hack above
.text(function(d) { return d.name.substring(0, d.r / 3); });
// update labels
// tooltip and circle size on hover
node.on("mouseover", function(d){
tip.style("opacity", .9);
tip.html(d.name)
.style("left", (d3.event.pageX) + "px")
.style("top", (d3.event.pageY - 28) + "px");
if(!d.children){
d3.select(this.firstChild)
.transition()
.duration(dur/10)
.ease("cubic")
.attr("r", function(d) { return d.r * 1.2; })
.style("opacity", 0.9);
}
});
node.on("mouseout", function(d){
tip.style("opacity", 0);
if(!d.children){
d3.select(this.firstChild)
.transition()
.duration(dur/10)
.attr("r", function(d) { return d.r; })
.style("opacity", 1);;
}
});
// bars
if(dataSet == 2){
node.filter(function(d) { return !d.children; }).on("click", function(d){
d3.select(".svgRightWrapper")
.style("border-left-color","#BFBFBF")
.style("border-left-width", "1px");
var svgRight = d3.select(".svgRightWrapper").append("svg")
.classed("svgRight", true)
.attr("width", 230)
.attr("height", 100);
var headline = svgRight.append("text")
.text(d.name)
.style("font-size", 10)
.style("fill","#6C7A89")
.style("font-weight", "bold")
.attr("x", 0 )
.attr("y", 10);
var barPotential = svgRight.append("rect")
.attr("width", d.potential)
.attr("height", 20)
.attr("x", 0)
.attr("y", 20)
.style("fill","#6C7A89");
var barNonPotential = svgRight.append("rect")
.attr("width", d.nonPotential)
.attr("height", 20)
.attr("x", 0)
.attr("y", 41)
.style("fill","#999");
var textPotential = svgRight.append("text")
.text(d.potential + "% Potentials")
.style("font-size", 10)
.style("fill","#6C7A89")
.attr("x", d.potential + 4 )
.attr("y", 20 + 20 / 2 + 10 / 4); // convoluted hack but works w. width / 2 + font-size / 4
var textNonPotential = svgRight.append("text")
.text(d.nonPotential + "% Non-Potentials")
.style("font-size", 10)
.style("fill","#999")
.attr("x", d.nonPotential + 4 )
.attr("y", 41 + 20 / 2 + 10 / 4); // convoluted hack but works w. width / 2 + font-size / 4
// exceptions
if (d.name == "Age"){
textPotential.text(d.potential + " years Potentials");
textNonPotential.text(d.nonPotential + " years Non-Potentials");
} else if (d.name == "Children") {
headline.text("No. of children (" + d.category + ")");
textPotential.text(d.potential + " Potentials")
.attr("x", (d.potential * 10) + 4 );
textNonPotential.text(d.nonPotential + " Non-Potentials")
.attr("x", (d.nonPotential * 10) + 4 );
barPotential.attr("width", d.potential * 10);
barNonPotential.attr("width", d.nonPotential * 10);
} else if (d.name == "Residence") {
headline.text("Live in a flat (" + d.category + ")");
} else if (d.name == "Income") {
textPotential.text("£" + d3.round((d.potential / 1000),0) + "k Potentials")
.attr("x", (d.potential / 1000) + 4 );
textNonPotential.text("£" + d3.round((d.nonPotential / 1000),0) + "k Non-Potentials")
.attr("x", (d.nonPotential / 1000) + 4 );
barPotential.attr("width", d.potential / 1000);
barNonPotential.attr("width", d.nonPotential / 1000);
}
d3.select(".svgRightWrapper").on("dblclick", function(){
d3.select(this).remove();
});
});
}
// exit
node.exit()
.transition()
.duration(dur / 2)
.style("opacity", 0)
.remove();
// exit the node objects (= g elements incl. circle and text)
}
d3.select(self.frameElement).style("height", diameter + "px");
getNewData1();
body{
font-family:"Lato" sans-serif;
}
div#header {
height:100px;
width:100%;
border-bottom-style:solid;
border-bottom-width:1px;
border-bottom-color:#BFBFBF;
margin: 20px 0 30px 0;
}
div#header h1 {
font-size: 18px;
margin-left: 5px;
}
div#header p {
margin:5px;
font-size:14px;
color: #6C7A89;
}
div.container {
position:relative;
}
div.buttonWrapper {
position: relative;
}
div.buttonWrapper1 {
position:absolute;
height:40px;
width:180px;
top: -10px;
display: table;
border-style: solid;
border-width: 1px;
border-color: white;
border-radius: 2px;
font-size: 12px;
color: #6C7A89;
background: #F2F1EF;
transition:background 0.5s ease;
}
div.buttonWrapper1:hover {
background: #DADFE1;
}
div.buttonWrapper2 {
position:absolute;
height: 40px;
width: 180px;
top: 32px;
display: table;
border-style: solid;
border-width: 1px;
border-color: white;
border-radius: 2px;
font-size: 12px;
color: #6C7A89;
background: #F2F1EF;
transition:background 0.5s ease;
}
div.buttonWrapper2:hover {
background: #DADFE1;
}
p#button1 {
display: table-cell;
vertical-align: middle;
text-align: center;
}
p#button2 {
display: table-cell;
vertical-align: middle;
text-align: center;
top: 42px;
}
div.tooltip {
position: absolute;
display: inline-block;
padding: 5px;
background: #F2F1EF;
font-size: 12px;
color: #6C7A89;
border-radius: 2px;
transition: opacity 0.6s;
-webkit-transition: opacity 0.6s; /*for some Safari versions*/
pointer-events: none;
}
div.svgRightWrapper{
position:absolute;
overflow-y: auto;
display: inline-block;
padding:20px;
top:40px;
left:880px;
width:460px;
height:700px;
border-style:solid;
border-color:white;
}
div#reloadPage{
position:absolute;
top:10px;
left:1240px;
width:70px;
height:20px;
line-height:20px;
font-size:10px;
color:#6C7A89;
text-align:center;
background: white;
transition:background 0.5s ease;
}
div#reloadPage:hover {
background: #DADFE1;
}
div#footer {
height:100px;
width:100%;
line-height:170px;
text-align:center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment