D3 zoom and pan zooming independently on mouse and programmatically - reactjs

Could some kind and clever D3 soul please put me out of my misery. I have the following example setup - https://codesandbox.io/s/compassionate-night-kpqc8t?file=/src/App.js. There are zoom buttons and the svg takes mouse events to initiate zoom. Problem is that the zoom triggered by the button is independent of that triggered by the button.
I believe this stackOverflow describes the problem and the solution - D3.zoom jumps when using mouse wheel after programmatically zoom - I just cannot figure out the implementation for the life of me in the context I have.

I got it to work. I'm not entirely sure what the difference is, but somewhere along the line I must've been targeting the wrong element...
At the bottom of this article - https://www.d3indepth.com/zoom-and-pan/ - is an example codepen. Following the codepen to the letter resolved my issue.
Thanks,
Simon

Related

SciChart changing the color map on a FastHeatMapRenderableSeries

I'm a long-time user of SciChart, but it's an old version (3.1). I've just started using FastHeatMapRenderableSeries for the first time, and there is a requirement for a user to alter the chart's gradient stops. I've implemented a UI to do this (see image), which involves dragging markers that updates their respective gradient stop within the ColorMap's LinearGradientBrush. It's working in as much as gradient changes can be seen in the chart's HeatColorMap (not shown on this screenshot), and also in my "drag" control (a Rectangle whose Fill is bound to the ColorMap's brush).
The problem is that the colours within the chart itself don't change - perhaps I was being a little too hopeful that this would happen automatically! Is this possible, or will I have to recreate the series each time there has been a change to the gradient?
We actually have this working in a later version of SciChart. Im not sure which version exactly but it was introduced at some point. Have a look at this forum post which discusses a bug in the heatmap color map binding in v5.
In the v6 examples suite, you can drag the heat map legend and recolour the chart automatically, so we know in principle this works.
Very cool image by the way!

Circular Slider in WPF

I really want to create circular slider. I've been searching, but I can't find any information. So any tutorial, guide or if someone already created like this. Please post their XML code.
Instead of making a circular slider (which as #auburg points out) would be a little unintutive to use (think the old telephone dials), consider making it a dial like a thermostat:
It's functionally very similar, but has a much larger hit-test area and is therefore less easy to mess-up for the user.
Try this guide: https://blogs.msdn.microsoft.com/jerrynixon/2012/12/06/walkthrough-building-a-sweet-dial-in-xaml-for-windows-8/
A circular slider can be implemented just like a normal horizontal or vertical slider. The only difference would be that in the MouseMove event handler of the thumb during the drag operation you cannot just handle the horizontal or vertical position. Instead you have to calculate the angle relative to the center of the slider and map that to the value of the slider.

Qooxdoo focus partially hides button image

I'm trying to make a ToggleButton as small as possible while still retaining the image; however, when the button has focus it moves the image to the right and partially hides it. How can I overcome this? I've tried padding and margins but neither seemed to work.
Here's an example:
http://preview.tinyurl.com/8y4arrl
Thanks for the help!
I could reproduce the issue when toggling the button twice (on - off), and then moving between hovered and not hovered. Please open a bug for this. It has to do with the decoration of the focussed and hovered states, but only shows when you set dimensions and padding as you did. Please add your Playground link and describe the procedure (on - off - hover - not hover). Thanks.

Is there any way to make a MapPolyline have better performance on WP7

I'm currently using the Silverlight Map control for WP7, and am trying to visualize driving directions on the map. In order to highlight the route needed, I am using a MapLayer with a MapPolyline. The problem is that even with CacheMode set to BitmapCache, the MapPolyline area gets redrawn whenever the user pans or zooms the map. I've used other controls such as Ellipses or Pushpins, and with BitmapCache on, none of them redraw and give the same performance hit as MapPolyline.
Here's a quick example
<maps:Map ZoomLevel="3">
<maps:MapPolyline Name="line" Stroke="Red" StrokeThickness="9">
<maps:MapPolyline.CacheMode>
<BitmapCache/>
</maps:MapPolyline.CacheMode>
<maps:MapPolyline.Locations>
<maps:LocationCollection>
<geo:GeoCoordinate Latitude="33" Longitude="33"/>
<geo:GeoCoordinate Latitude="36" Longitude="33"/>
<geo:GeoCoordinate Latitude="33" Longitude="36"/>
</maps:LocationCollection>
</maps:MapPolyline.Locations>
</maps:MapPolyline>
</maps:Map>
If you set App.Current.Host.Settings.EnableRedrawRegions = true; you can see the redrawing that occurs. The performance is particularly bad when you have a larger polyline and zoom in closer.
Is there anything that can be done to help? The native Bing Maps has pretty smooth route drawing, so I would think that there should be a way to solve this?
Thanks!
Can you explain a bit more what the problem is?
I've got an app - RunSat - in which I draw polylines with several hundred points (e.g. I just looked at a 3 hour long bike ride) and this draws fine - including during zoom operations.
I don't understand the problem - even using the sample code above. To help - are you testing on a phone or on the emulator?
As for CacheMode and BitmapCache, I'm really not sure about using these settings for the map - I don't use them in RunSat if that helps - I just leave the phone alone to work out its own GPU drawing.

How to achieve rotating form effect in wpf

I would like to make a rotating form WPF effect like the one in the norton antivirus 2010.
The effect is a rotating form that changes the contents when the other side is shown. But the axis is not in the center of the form but moves from side to center and back. Like a three step effect.
The rotating form can be seen at 8' 07" in this video: http://www.youtube.com/watch?v=A3hHPdgi9Nk&feature=related (I'm sad but this was the only video I found on YouTube)
Thanks.
Have a look at the Thriple stuff on CodePlex: http://thriple.codeplex.com/
It's almost exactly what you're after.
Hope this helps.
I did not examine the details, but I know that Microsoft's patterns & practices team also uses a similar animation in their "StockTrader Reference Implementation" for the "Composite Application Guidance". They sub-classed the TabControl and added some animation to it. I think the relevant code parts can be found here:
AnimatedTabControl.Desktop.cs
Generic.xaml
just verify this link. It has code as well as the Sample.
From the Sample take the TransitionPresenter link from the left panel and choose the 3D Rotate item from the listbox. Then select the images from the top list. You can see the same effect in the video. I saw some initial sanp of the video and may be this link can help you.
http://bot.codeplex.com/

Resources