brush

d3.js brush fill color histogram

放肆的年华 提交于 2019-12-04 03:38:45
i have created some histogram with d3.js . I managed to change fill color of rect depending on the position of the brush . But i would like to change the color inside a rect . For example if the brush start is in the middle of the rect i would like to have my rect with two color. At the moment this is what i have : And this is what i would like to have : I have seen some examples like Here . I'm new to d3 and i try to understand the code. I see that they use clip-path that certainly hide the background bar when their is no brush and show them when their is one depending on the range of the

What is the best way to pick a random brush from the Brushes collection in C#?

末鹿安然 提交于 2019-12-03 15:02:01
What is the best way to pick a random brush from the System.Drawing.Brushes collection in C#? If you just want a solid brush with a random color, you can try this: Random r = new Random(); int red = r.Next(0, byte.MaxValue + 1); int green = r.Next(0, byte.MaxValue + 1); int blue = r.Next(0, byte.MaxValue + 1); System.Drawing.Brush brush = new System.Drawing.SolidBrush(Color.FromArgb(red, green, blue)); For WPF, use reflection: var r = new Random(); var properties = typeof(Brushes).GetProperties(); var count = properties.Count(); var colour = properties .Select(x => new { Property = x, Index =

Disable clearing of D3.js brush

淺唱寂寞╮ 提交于 2019-12-03 13:17:08
问题 I would like to use a D3.js brush to allow users to select a range of values on an axis. By default, clicking outside the brush clears it, so that no range is selected. However, I would like to adjust this behaviour so that clicking outside the brush doesn't alter the brush extent. In effect, there should be no way to clear the brush, some range should always be selected. I believe I have to hook into the brush event somehow to disable the clearing, but I don't really know how to go about

Update the y-axis of a brushed area chart

时光毁灭记忆、已成空白 提交于 2019-12-03 11:15:23
问题 I am using d3.js, and I'm working on a brushed area chart by modifying this example. In addition to the x-axis changing based on the brush, I'd like chart's y-axis to be redrawn, based on the y-values of the data that fall within the brush (similar to the behavior of a Google Finance chart). I have gotten the functionality working, but only in a way that enables the brush to be drawn in both x- and y-space. I did this by first adding a y scale to the brush variable: var brush = d3.svg.brush()

Android custom brush pattern/image

本秂侑毒 提交于 2019-12-03 07:25:33
I have an 8x8 Image. (bitmap - can be changed) What I want to do is be able to draw a shape, given a Path and Paint object onto my SurfaceView . At the moment all I can do is fill the shape with solid colour. How can I draw it with a pattern. In the image you can see the brush pattern (The cross). It can be anything from a cross to a donut or an elf. How would I go about drawing this pattern background. I also eventually want to apply colours to it. So far, my theory is to create a clip area of the shape, and tile the bitmaps until area is covered, but this is extreme overkill in processing.

Update the y-axis of a brushed area chart

强颜欢笑 提交于 2019-12-03 02:50:27
I am using d3.js, and I'm working on a brushed area chart by modifying this example . In addition to the x-axis changing based on the brush, I'd like chart's y-axis to be redrawn, based on the y-values of the data that fall within the brush (similar to the behavior of a Google Finance chart ). I have gotten the functionality working, but only in a way that enables the brush to be drawn in both x- and y-space. I did this by first adding a y scale to the brush variable: var brush = d3.svg.brush() .x(x2) .y(y2) .on("brush", brush); This makes brush.extent() return the following multi-dimensional

2013, Existing package for drawing (painting, brush, lines) in iOS?

跟風遠走 提交于 2019-12-03 00:39:43
I need to add typical finger drawing to an app. (The usual.... choose colors, erase, thickness - just the usual you see in every app made.) It's hard to believe I have to program this from scratch, in this day and age? It's hard to believe there is not a common solution for this? All I could find is... https://github.com/levinunnink/Smooth-Line-View Review : that is a (beautifully written) example fragment of a few lines of code being how to draw with a path, with a good smooth result. It works perfectly, but it's just for drawing one "path." For example, you can't make a drawing with more

Issue with updating d3 interactive matrix scatterplot to v4

风格不统一 提交于 2019-12-02 10:10:09
问题 I'm trying to improve my skills with D3.js by updating various v3 scripts I'm interested in to v4, but I got stuck while trying to "port" the interactive scatterplot matrix that Mike Bostok posted here: https://bl.ocks.org/mbostock/4063663 While I've ported with no problem the static version of the code (with no brush), when trying to implement the brush in the same fashion as in v3, I have found an issue that seems an actual D3 problem more than being related to my D3 noob-ness: brush seems

solid brush property not binding

做~自己de王妃 提交于 2019-12-02 10:05:28
I have a class X there are some data: private string yyy; public string YYY { get { return yyy; } set { yyy= value; NotifyPropertyChanged("YYY"); } } private SolidBrush color; public SolidBrush Color { get { return color; } set { color= value; NotifyPropertyChanged("Color"); } } My Data Grid bind to this class like this: <DataGrid x:Name="dg1" ItemsSource="{Binding}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTemplateColumn Header="yyy" > <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding YYY}" Foreground="{Binding Color}"/> </DataTemplate> <

HTML5 canvas paint blending color tool

百般思念 提交于 2019-12-02 08:38:37
问题 Hello i need create blending color tool, i try take color pixel from canvas with getImageData and mixed with my selected color and get average color, i can get it with easy: /* r1 = red channel from getImageData g1 = green channel from getImageData b1 = blue channel from getImageData r2 = red channel my selected color g2,b2 same */ var avR = Math.round(0.5*r1 + 0.5*r2); var avG = Math.round(0.5*g1 + 0.5*g2); var avB = Math.round(0.5*b1 + 0.5*b2); While i drawing i try mixed this colors, but