jsPlumb Connector Paint Style Gradient inconsistent - jsplumb

Issue: Connector paint style gradients don't always gradient.
I am creating connections between a few HTML elements on my page. To look nice, I'm aiming to have the connection lines painted as a gradient, starting with the source point being the color of the source object's background color, and the target point being the color of the target object's background color. It's working well, but not for each connection, which is strange.
This code creates the connections, it's wrapped in a function so I can call it with each "$(object).each" iteration.
Here is the full function:
createConnection = (source_id, target_id, source_color, target_color) =>
console.log "source color : "+ source_color + " | target color : " + target_color
jsPlumb.connect({
source: source_id,
target: target_id,
anchors:["Bottom", "Top"],
connector: ["Bezier", { curviness: 60 }],
endpointStyles:[
{ fillStyle: source_color },
{ fillStyle: target_color },
],
paintStyle: {
gradient: { stops: [
[ 0, source_color ],
[ 1, target_color ]
] },
strokeStyle: "#fff",
lineWidth: 13
},
endpoint: ["Dot", { radius: 10 }],
});
(Code is written in CoffeeScript, btw)
The gradients work well in certain scenarios, but not all. Let me show you:
Here we have a scenario where each object has one child. This is where none of them work:
Console output from this:
source color : rgb(30, 47, 109) | target color : rgb(61, 117, 150)
source color : rgb(61, 117, 150) | target color : rgb(51, 185, 191)
source color : rgb(51, 185, 191) | target color : rgb(70, 173, 125)
Notice the endpoints are working correctly, just not the connection lines.
Here is where I added an object, you can see that some of the gradients do work perfectly, some work partially, and some don't work at all. here:
Here is the console output:
(2) source color : rgb(30, 47, 109) | target color : rgb(61, 117, 150)
source color : rgb(61, 117, 150) | target color : rgb(51, 185, 191)
source color : rgb(51, 185, 191) | target color : rgb(70, 173, 125)
The (2) shows us that the first two connections use the same colors, both worked. In this example, only the last connector didn't work.
Here is another example, with another child added to "Hyperproduct X".
Console output:
(2) source color : rgb(30, 47, 109) | target color : rgb(61, 117, 150)
source color : rgb(61, 117, 150) | target color : rgb(51, 185, 191)
(2) source color : rgb(51, 185, 191) | target color : rgb(70, 173, 125)
In this last image, you'll notice that all of the connectors are painted correctly.
This is so weird! Why don't they work for all configurations?
Thanks in advance for any guidance or help.

Related

How to chart d3 venn diagram with two distinct sets?

I'm trying to draw venn diagram in d3 from the post as below.
http://bl.ocks.org/bessiec/986e971203b4b8ddc56d3d165599f9d0
I used the data as below.
var sets =[
{sets:["students"], figure: 600, label: "students", size: 600},
{sets:["pass"], figure: 455, label: "pass", size: 455},
{sets:["students","pass"], figure: 455, label: "", size: 455},
{sets:["students","fail"], figure: 145, label: "", size: 145},
{sets:["pass","fail"], figure: 0, label: "", size: 0},
{sets:["fail"], figure: 145, label: "fail", size: 145},
];
I want that students pass + fail must get into the students, how to shall i do that with the above library.
There are 600 students, of which 455 passed and 145 failed. then the two circles must be in students. How shall i achieve it using the above library, if not is there any d3 library to draw venn diagrams of such sceanarios.

How to change text colors through code in Xcode

I am trying to make a button that changes the color of the text and shadow in a label called labelDisplay in Xcode. I have tried using the following code inside a button's press function:
labelDisplay.textColor = UIColor(displayP3Red: 1, green: 1, blue: 1, alpha: 1)
labelDisplay.shadowColor = UIColor(displayP3Red: 60, green: 60, blue: 60, alpha: 1)
and in another button:
labelDisplay.textColor = UIColor(displayP3Red: 183, green: 181, blue: 60, alpha: 1)
labelDisplay.shadowColor = UIColor(displayP3Red: 145, green: 143, blue: 52, alpha: 1)
I don't know why, but when I go into the simulator and press any of these buttons, this error appears in the output box:
2018-04-20 14:09:12.641080 HelloWorld_Brandon[2362:34953] [Graphics] UIColor created with component values far outside the expected range. Set a breakpoint on UIColorBreakForOutOfRangeColorComponents to debug. This message will only be logged once.
Can anyone help me with this?
Are you using the Display P3 color space intentionally?
Either way, the arguments are "specified as a value from 0.0 to 1.0" according to the docs, and 183 is way bigger than that. Try specifying 0.71 or 183.0/255.0 instead.

How to increase/decrease height of Sublime status bar?

I was successful at modifying the sidebar_container and tabset_control of Material Theme except the status bar. It is a bit too big for me and I want to adjust the height of it like Piatto's (also the width/height of button if possible).
Material Theme: (modified, except status bar)
Piatto Dark Theme:
How do I set height/width of the status bar? (and also buttons on it, if possible)
You can try add the following code to your .sublime-theme file. Modify the values in the "content_margin" to adjust the height.
{
"class": "status_bar",
"content_margin": [0, 0, 0, 0]
},
{
"class": "status_button",
"content_margin": [0, 0, 0, 0],
"min_size": [75, 0]
}
Or add the following in the user setting:
"material_theme_small_statusbar": true

jqPlot MeterGaugeRenderer - set diameter causes error

I am showing multiple Meter Gauges on a single page, in conjunction with Bootstrap, to provide responsiveness. What is obvious is they are all calculating slightly different sizes, so I hoped to use diameter.
Here is my working code:
s1 = [322];
$.jqplot('spend',[s1],{
seriesDefaults: {
renderer: $.jqplot.MeterGaugeRenderer,
rendererOptions: {
min: 100,
max: 500,
intervals:[200, 300, 400, 500],
intervalColors:['#66cc66', '#93b75f', '#E7E658', '#cc6666'],
intervalOuterRadius: 56,
ringColor: '#222',
padding: 3,
tickColor: '#111',
ringWidth: 4,
needleThickness: 11,
shadowOffset: 10,
label: "£"
}
},
title: 'Spend'
});
If I add
diameter:200,
I get no output, and:
'this._center.0' is null or not an object jqplot.meterGaugeRenderer.js, line 616 character 13
'this._center.0' is null or not an object jqplot.meterGaugeRenderer.js, line 616 character 13
I have also tried
diameter:50,
and
diameter:500,
in case I was not providing adequate space, or too much space, but I rather doubt it, as intervalOuterRadius is set at 56, I have also assumed that
diameter:200
is correct syntax given that
intervalOuterRadius:56
(as well as various other values) is correct. I cannot find anyone else who has had this problem, and have had no response on the jqplot google group.
Oh yeah, and I'm primarily writing for IE8 atm but it will need to be used on ie11 in time.

Sublime Text 2 : colour of edited file tab?

I see that the Sublime Text theme (.config/sublime-text-2/Packages/Theme - Default/Default.sublime-theme) can be edited to make the open tab more obvious.
For that I use
{
"class": "tab_control", "attributes": ["selected", "file_medium_dark"],
"tint_modifier": [0, 255, 0, 32]
/* ... */
},
which makes the tab greener.
Is there a similar method for colouring the tab of an edited (unsaved) file/buffer?
Thanks.
After a little hunting around together with Mikko's suggestion of looking at the change log:
In Settings-User opened from Preferences | Settings add in the line
"highlight_modified_tabs": true,
This will make the tab text orange whenever there are unsaved changes to a file.
To change the color from orange, a bit of further digging around and experimentation was needed and revealed that editing the theme was one way to change the color from orange.
Theme files can be located in in the Color Scheme - Default folder accessed from the menu Preferences | Browse Packages... - you will have to make these changes for every theme that you'd like to change the text color for:
{
"class": "tab_control", "attributes": ["selected", "file_medium_dark"],
"tint_modifier": [0, 255, 0, 40],
"layer2.texture": "Theme - Default/medium_dark_selected_tab_bg.png",
"layer2.opacity": 0.7
},
{
"class": "tab_control", "attributes": ["dirty", "file_medium_dark"],
"tint_modifier": [255, 0, 0, 40],
"layer2.texture": "Theme - Default/medium_dark_selected_tab_bg.png",
"layer2.opacity": 0.7
},
{
"class": "tab_control", "attributes": ["selected", "dirty", "file_medium_dark"],
"tint_modifier": [255, 255, 0, 40],
"layer2.texture": "Theme - Default/medium_dark_selected_tab_bg.png",
"layer2.opacity": 0.7
},
It would be nice to be control the behavior of "selected" and "dirty" (=modified) separately. That might be possible with the layers, but I don't understand those well enough yet.
Addenda
(1) The above is for dark themes. For a light theme, omit the "file_medium_dark" from the attributes.
(2) The same changes apear to work in Sublime Text 3 (~/.config/sublime-text-3/Packages/Default.sublime-theme).
This is the best solution I have found:
https://coderwall.com/p/jg4kog
Inside of Sublime Text go to Preferences > Browse packages
Navigate to the User folder.
There you create a file called Default.sublime-theme
Open that file in Sublime Text and copy and paste the following JSON
object:
[{
"class": "tab_control",
"attributes": ["selected", "file_medium_dark"],
"tint_modifier": [255, 255, 255, 80]
}]
I had the same problem, and found what for me is a great solution. I replaced the graphics icons used on the tabs to make dirty tabs much more visible.
Replacing the dirty_circle, dirty_circle_light, and dirty_indicator graphics does the trick.
The details, along with some nice graphics, can be found here:
http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5630

Resources