How to create a multicolored line chart with nativescript. (https://i.stack.imgur.com/Pk8bi.png)
I guess for each color you like to apply, you will have to define a separate LineSeries and Palette.
Example
<RadCartesianChart>
<CategoricalAxis tkCartesianHorizontalAxis></CategoricalAxis>
<LinearAxis tkCartesianVerticalAxis>
</LinearAxis>
<LineSeries tkCartesianSeries selectionMode="Series"
[items]="categoricalSource1" categoryProperty="Country"
valueProperty="Amount">
</LineSeries>
<LineSeries tkCartesianSeries selectionMode="Series"
[items]="categoricalSource2" categoryProperty="Country"
valueProperty="Amount">
</LineSeries>
<LineSeries tkCartesianSeries selectionMode="Series"
[items]="categoricalSource3" categoryProperty="Country"
valueProperty="Amount">
</LineSeries>
<Palette tkCartesianPalette>
<PaletteEntry tkCartesianPaletteEntry strokeWidth="5"
strokeColor="Orange"></PaletteEntry>
<PaletteEntry tkCartesianPaletteEntry strokeWidth="5"
strokeColor="Blue"></PaletteEntry>
<PaletteEntry tkCartesianPaletteEntry strokeWidth="5"
strokeColor="Pink"></PaletteEntry>
</Palette>
</RadCartesianChart>
Refer advanced styling example on Github
Related
I am trying to style my app with a dark theme and the legend items are black. Is there a way to change the color of the legend items? There is a property to change the title color but that doesn't effect the other series names.
example picture
<RadPieChart allowAnimation="true" height=100% row="1" col="0" colSpan="12">
<DonutSeries tkPieSeries
selectionMode="DataPoint"
expandRadius="0.4"
outerRadiusFactor="0.7"
innerRadiusFactor="0.4"
valueProperty="Amount"
legendLabel="Country"
[items]="Countries" class="white"></DonutSeries>
<Palette tkPiePalette >
<PaletteEntry tkPiePaletteEntry fillColor="#EB5E55" strokeColor="#EB5E55"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#D81E5B" strokeColor="#D81E5B"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#FDF0D5" strokeColor="#FDF0D5"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#C6D8D3" strokeColor="#C6D8D3"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#00FDDC" strokeColor="#00FDDC"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#495F41" strokeColor="#495F41"></PaletteEntry>
</Palette>
<Palette tkPiePalette seriesState="Selected">
<PaletteEntry tkPiePaletteEntry fillColor="#EB5E55" strokeColor="#EB5E55"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#D81E5B" strokeColor="#D81E5B"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#FDF0D5" strokeColor="#FDF0D5"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#C6D8D3" strokeColor="#C6D8D3"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#00FDDC" strokeColor="#00FDDC"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#495F41" strokeColor="#495F41"></PaletteEntry>
</Palette>
<RadLegendView tkPieLegend position="Right" title="Country" offsetOrigin="TopRight" width="110" enableSelection="true" titleColor="white"></RadLegendView>
</RadPieChart>
I don't think it's supported as of today, there is an open feature request in Github you might want to follow.
As a workaround you may turn off default legend view and render your own list of legends using Labels.
We use an application (using JSF2 (Mojara))that has some large pages using ui:repeat tag and which has been deployed on JBoss EAP 6.0 version. Of late, we have been facing very high CPU utilisation during our performance tests and the thread dumps indicate that UIRepeat could probably be the cause of it.Have placed the trace from one of the thread dumps below which was a suspect and was taking 90+% of the CPU:
Any help in this regard would be great.
"ajp-/10.138.51.32:8209-9" daemon prio=10 tid=0x00007fa3cc2a3800 nid=0x52a6 runnable [0x00007fa3fa0d9000]
java.lang.Thread.State: RUNNABLE
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72)
at org.apache.el.parser.AstValue.getValue(AstValue.java:147)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:217)
at com.sun.faces.facelets.el.ELText$ELTextComposite.toString(ELText.java:157)
at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:89)
at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
at com.sun.faces.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:104)
at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:523)
at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:984)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:104)
at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:523)
at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:984)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.facelets.component.RepeatRenderer.encodeChildren(RepeatRenderer.java:104)
at com.sun.faces.facelets.component.UIRepeat.process(UIRepeat.java:523)
at com.sun.faces.facelets.component.UIRepeat.encodeChildren(UIRepeat.java:984)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:518)
at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
at javax.faces.component.UIForm.visitTree(UIForm.java:381)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:297)
at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
at org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:169)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:357)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:67)
at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:48)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:505)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:452)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931)
at java.lang.Thread.run(Thread.java:662)
Locked ownable synchronizers:
- None
I'm trying to use Animate in MXML to move a button along X or Y axis.
My button increase width when clicked, but does not move at all. What is wrong with this code ? It should be something really simple, but I can't find it.
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
initialize='init()'>
<fx:Script>
<![CDATA[
public function init():void {}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout id='l' horizontalAlign="left" />
</s:layout>
<fx:Declarations>
<s:Animate id="mover" target="{button}" duration="1000">
<s:SimpleMotionPath property="x" valueFrom="0" valueTo="100"/>
<s:SimpleMotionPath property="y" valueTo="100"/>
<s:SimpleMotionPath property="width" valueBy="20"/>
</s:Animate>
</fx:Declarations>
<s:Button id="button" click="mover.play()" label="Button"/>
</s:Application>
I got this sample from Adobe docs. I think it should be related to layout or something like that, but all my tries of changing layout, including into a Canvas or other tricks does not change anything : the button still stay at the same place.
Thanks for your help !
The problem is caused by the use of the VerticalLayout. This layout, as well as the HorizontalLayout, ignores x/y properties of the objects that are being laid out.
If you remove your layout declaration altogether, it will then use the default BasicLayout which will honor the x/y properties and allow your animation to work.
Silverlight toolkit provides us only with turnstile transition and not turnstile feather. (The one on the home screen of windows phone 7 where all the tiles flip before the selected one.)
I have looked through the following links and they have not helped me, so I am looking for answers with information not included here:
http://www.windowsphonegeek.com/articles/wp7-transitions-in-depth--key-concepts-and-api
http://blogs.claritycon.com/blog/2010/10/wp7-page-transitions-sample/
http://www.scottlogic.co.uk/blog/colin/2011/03/metro-in-motion-part-2-peel-animations/
http://www.codeproject.com/Articles/117360/Windows-Phone-7-Turnstile-Control-for-Silverlight
The new Windows Phone Toolkit has support for TurnstyleFeatherTransition. http://phone.codeplex.com/
here is how you can implement it.
Step 1 => First go to => App.xaml.cs and change your RootFrame to Transition Frame.
RootFrame = new TransitionFrame();
Step 2 => Go to your page on which you want to implement the TurnstyleFeatherTransition Animation and add this Animation Code that enable the TurnstyleFeatherTransition. Put it just before your RootGrid/Root container
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
Step 3 => Give feather index to controls. by adding the following code.
toolkit:TurnstileFeatherEffect.FeatheringIndex="0"
e.g =>
<Button toolkit:TurnstileFeatherEffect.FeatheringIndex="0" ></Button>
You are good to go :)
When the application starts, I have a splashscreen after which the mainpage.xaml is loaded. The Mainpage has a lot of UI elements such as buttons and textblocks. It takes about a second or two to load this so I thought some animation could fill in the gap. Else it might look a bit awkward.
Windows phone native application such as the messages, uses some default animation when the page opens right, the pivot headers swivels in then followed by the other UI, the door opening kind of thing. After a bit of researchin I found that they are the default fault turnstile animations.
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
So I have put in the above code just above the </phone:PhoneApplicationPage> tag of the MainPage. But the elements of the page do not have the turnstile animation, how can i apply it to the other UI elements in the page?? Could someone guide me on this?
Alfah
What you are referring to is called a "feather turnstile" or "peel" transition.
There are three implementations that I know of:
Colin Eberhardt's "peel" animation as part of his Metro In Motion series (free, includes source)
Clarity Consulting's turnstile transition (free, includes source)
Telerik's RadControls for Windows Phone (not free, no source)
None of the above integration into the toolkit's transition framework. I've considered doing so myself, but never had the time.
The Windows Phone Toolkit also has the TurnstileFeather transition. This basically seems to be activated as follows,
Change App.xaml.cs so that RootFrame = new TransitionFrame()
Include the toolkit in the XAML for the animated page e.g. xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Include the following XAML just after the opening tag (similar to what you pasted),
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
Finally on each container element place the following attribute toolkit:TurnstileFeatherEffect.FeatheringIndex="0" with the number relating to the order in which you want the elements to peel away in. e.g.
<TextBlock toolkit:TurnstileFeatherEffect.FeatheringIndex="0">Cheetah</TextBlock>
<TextBlock toolkit:TurnstileFeatherEffect.FeatheringIndex="1">Hare</TextBlock>
<TextBlock toolkit:TurnstileFeatherEffect.FeatheringIndex="2">Tortoise</TextBlock>
You can use feather transition on any control like i have used textblock in this example.
<toolkit:TransitionService.NavigationInTransition>
<toolkit:NavigationInTransition>
<toolkit:NavigationInTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardIn"/>
</toolkit:NavigationInTransition.Backward>
<toolkit:NavigationInTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardIn"/>
</toolkit:NavigationInTransition.Forward>
</toolkit:NavigationInTransition>
</toolkit:TransitionService.NavigationInTransition>
<toolkit:TransitionService.NavigationOutTransition>
<toolkit:NavigationOutTransition>
<toolkit:NavigationOutTransition.Backward>
<toolkit:TurnstileFeatherTransition Mode="BackwardOut"/>
</toolkit:NavigationOutTransition.Backward>
<toolkit:NavigationOutTransition.Forward>
<toolkit:TurnstileFeatherTransition Mode="ForwardOut"/>
</toolkit:NavigationOutTransition.Forward>
</toolkit:NavigationOutTransition>
</toolkit:TransitionService.NavigationOutTransition>
if you are using pivot then use this
<controls:Pivot toolkit:TurnstileFeatherEffect.FeatheringIndex="0" Title="MY APPLICATION">
and then use the effect in any control
<TextBlock toolkit:TurnstileFeatherEffect.FeatheringIndex="1" Text="Hello" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center"/>