connecting end point, duplicate same data, random color issue
Dear all forum member in NodeBox3
i have a problem of dealing with three problems
please help me some to get out this agony
1. Red Arrow
i want to connect the end point of that rect to look like smooth line graph, but what i do almost everything, but i cannot do like this
i draw it now by pencil tool
2. Blue Arrow
i want to get each category with different color, but when i did it, all of each data have random different color.
is there some more good idea to deal with categorized, random color?
3. Green Arrow
i want to draw thin, opened arc of 180 degree, but what i do was look up each date and set rectangular's width with each date
so what i want to do is setting rectangular, with same dataset
for example, if i have same date data, it will duplicated for one long rectangular, which width and height will be determined how many same data is there.
i find all forum and google, but now i come here to send SOS in this forum
thanks for reading this message
- howtodoit.png 385 KB
- visualization.zip 375 KB
|?||Show this help|
|ESC||Blurs the current field|
|r||Focus the comment reply box|
|^ + ↩||Submit the comment|
You can use
Command ⌘ instead of
Control ^ on Mac
Support Staff 1 Posted by john on 20 Nov, 2016 12:22 PM
I believe I was able to solve all three of your problems. The attached zip file contains a "modified second edition.ndbx" file that you can examine. Here's how I did it:
I added four nodes to translate node holding the rectangles in the center of your arc:
- Point converts each rectangle to its four corner coordinates
- Take Every takes every fourth coordinate (the corners closest to the center)
- Connect connects them into a path (with the "Closed" value unchecked)
- Colorize makes the fill transparent and strokes with a red line
I assume by "category" you mean unique values of the "Details of expenditures" (food) column. To make sure each category gets its own color, you have to build a lookup table with two columns, category and color. You do this with a zipmap, but in order to get it to work properly you have to wrap that zipmap inside a subnetwork - which I called "color list". Both input ports must be set to "value", not "list". Feed it the set of unique values and a set of random colors to create the color list table. Doubleclick on that node to see what the table looks like.
Then, for each individual food, use the Filter Data node to find the correct category row in the color list table, then lookup the color for that category and feed that to the Colorize node for each link. Foods in the same category will now get the same color.
(You can't do tricks like this without using subnetworks - a fact that was not at all obvious to me when I was first starting out.)
If I understood you correctly, I think you want to group repeating Expenditure dates into single boxes, the more repeating dates, the larger the box. It's actually pretty hard to do this with rectangles, so instead I modified one of my old donut chart nodes (like a pie chart but with a donut hole in the middle).
"Half Donut" takes a list of sizes and outputs wedges of each size to form a half donut of whatever size and thickness you want. To get a list of wedge sizes, I made another subnetwork called date_counts. This just filters the list of all dates to the rows containing each distinct date and then returns a count of each subset.
I modified your nodes to rotate each date label and place it in the center of each wedge. I added a switch so that labels on the left half of the arc would not turn upside down (located inside yet another subnetwork called calc_rotation).
Because there are so many distinct dates (436), most of the wedges are quite small. In order to fit the date labels inside these tiny wedges I had to reduce the font size to .4, too small to read unless you zoom way in.
I have also attached a PDF of the final result. I scaled the whole thing up by 180% to fill your 1000 x 1000 document size.
I hope this will get you out of your agony. Please let me know if this helped or if you have any more questions.