Multiple arcs in canvas with click events - html5-canvas

Problem :
Trying to create a layout looking like this one below where each portion is clickable and has separate entity.
Tried solution and problems with it :
create arc with canvas. Have to add the arc with stroke. Stroke is not clickable. Tried hacks from other answers but they don't seem to work.
Click Event on a Stroke of the Shape(arc) doesn't work

Instead of drawing with arcs, how about this:
use Wedges instead of Arcs
Draw the 3 outside shapes as Wedges and put them on a layer#1.
Draw the 10 inside shapes as Wedges and put them on another layer#2 above layer#1.
Draw the center circle as a Circle and put it on another layer#3 above layer#1 & layer#2.
Attach on.(“click”) to each individual wedge.
Layering will give you the visual "nesting" effect your looking for.
Layering will give you proper click control over each wedge-piece.

Related

How to make a tooltip for a chart in d3?

We need to make it move like here.example The code is complex there, I can't figure it out.
I wrote the code my code, but I don’t understand how to make the tooltip move horizontally not behind the mouse, but near the nearest horizontal mark (as in the example)
It is not yet clear where the text above the bold text in the tooltip comes from. How to remove it so that it looks like in the picture?
How do I make the title of the tooltip match the label on the X-axis?
There are many ways to accomplish this. The way I typically do this is to create a series of SVG elements -- such as circles or rects -- using the same scale and data as the paths.
You can make these objects visible or invisible. Either way, you can attach mouseenter, mouseleave events to each to render and populate the tooltip.

d3 trigger mouse click on specific coordinates

I have an issue on triggering mouse event on a svg.
I am using the library d3.js to handle some graphic tasks. Specifically, when I manually click on a position on the svg, d3 draws a red or blue (depending on the path I am clicking on) circle on it and then returns the d3.mouse coordinates of the click.
Now, suppose I have a set of coordinates and want to trigger programmatically click on the corresponding point on the svg, so that it draws a red or blue circle automatically. How can I achieve that?
I read many solutions here but none allows to click on specific coordinates (while I can easily click on a specific path, for example).
My ideal function would be:
var svgd3 = d3.select('svg#id_svg')
function d3click(x,y,svgd3){
//does the click on [x,y, x,y are relative coord. depending only svg viewBox
...
}
Any idea?
Thanks a lot!

how to make a single line text used as a glyph(mac develop)

Effect like the mac mail app,this image is a screenshot
how can i get effect like that. I try the cocoa text system,and don't find some useful things.
and I use the nstextattachment with textatttachmentcell initImageCell,obtain some effect like that,but it is not good,it is not very nature.
please some one give directions to me.
Those objects are not glyphs, they are controls, such as a subclass of a button. Custom controls have a drawing routine, which you override to draw a blue rectangle with round corners (a bezier path is the most flexible way to do so), then you draw the text (including the caret character) centered in the blue rectangle. Finally, handle the mouse events to do what you need to do when the control is clicked, such as popping up a menu in the right location.

How to draw track legend in Circos

This Circos tutorial showed configuring spacing between two chromosomes, so track legend can be placed in the area.
(source: circos.ca)
Like the the example above, but I can't find any explanation about how to draw text there just like right circle.
Is it possible to draw track legend using configuration file, or I need to use a graphic editor add text manually on the output image?

Get theme properties of Group Box lines

My goal is to draw a Group Box that is not rectangular but instead has the corners cut away. I do not mean just clipping the corners, but rather have a continuous closed path where the corners are "indented." I want this to match the colors/style of the current theme.
I noticed on Windows XP that the Group Box has 1-pixel gray lines, but on Windows 7 there is a 3D effect created by having a gray line next to a white line (the white line on the interior except on the bottom where it's below the gray line).
You can get the color of the text label of a Group Box using something like this:
COLORREF cref;
GetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &cref);
So, I'm trying to figure out how to get the color(s) and/or properties of the lines used in a Group Box, then (I hope to) be able to draw the lines I want matching the Group Box style by separately drawing each piece of the shape I want. I'm not sure what properties are used to describe the lines or if functions line DrawRect will draw the 3D effect with a suitable Pen. Is there a way to set a Pen to draw these 3D effects (2-shade parallel lines)?
Thanks.
The thing I always find unexpected about groupboxes is that they are really a style of buttons. (BS_GROUPBOX).
Themed groupboxes (XP and later with classic mode off) use theme part BP_GROUPBOX in VSCLASS_BUTTON. You can use the usual theme APIs to get and draw. If your Group box needs text you can use DrawThemeText.
There are APIs for drawing non-themed group boxes too (e.g. DrawEdge), but I don't remember the details and it's unlikely that you need them.
As usual, I will point out that reproducing the behaviour of controls is always harder than you think it is going to be.
Martyn

Resources