Different custom colors for a WPF line plot

Dear Sir,
I am trying to create a WPF graph with different colors for different points of time , example  Black 0-10,red 11-20, green 21-30...
I saw the nifty video and download the range masking cursor but got stuck. 
Thank you
George MAsiello

Here's a quick mockup of the custom renderer version (sorry I did not have time to translate it to VB myself):
    public class CustomRenderer : PlotRenderer {
        private static readonly DataRequirements _dataRequirements = new DataRequirements(
            DataCulling.PreserveLines, DataDecimation.CoLinear,
            new DataDimension( DataDimensionSource.IndexData, DataDimensionScale.IndependentScale ),
            new DataDimension( DataDimensionSource.SampleData, DataDimensionScale.DependentScale ) );
        // The color ranges we want to show on the plot.
        private readonly Tuple<Color, double>[] _colorRanges = new[] {
            Tuple.Create( Colors.Black, 10.0 ),
            Tuple.Create( Colors.Red, 20.0 ),
            Tuple.Create( Colors.Green, 30.0 ),
        private readonly RenderTargetOptions[] _rangeOptions;
        public CustomRenderer( ) {
            // Create render options for each range color.
            _rangeOptions = _colorRanges.Select( colorRange => new RenderTargetOptions( this,
                RenderTargetOption.CreateValue( RenderTargetOptionsProperty.Stroke, new SolidColorBrush( colorRange.Item1 ) ),
                RenderTargetOption.CreateValue( RenderTargetOptionsProperty.StrokeThickness, 1.0 ) ) )
            .ToArray( );
        public override SupportedRenderModes SupportedRenderModes {
            get { return SupportedRenderModes.VectorAndRaster; }
        public override DataRequirements GetDataRequirements( ) {
            return _dataRequirements;
        protected override Freezable CreateInstanceCore( ) {
            return new CustomRenderer( );
        protected override void RenderLegendCore( LegendRenderArgs renderArgs ) { }
        protected override void RenderGraphCore( PlotRenderArgs renderArgs ) {
            // Get the time axis for the renderer.
            Plot plot = (Plot)renderArgs.Plot;
            var timeAxis = plot.GraphParent.GetAxis( plot, Orientation.Horizontal );
            var dataMapper = (IDataMapper<double>)timeAxis.GetDataMapper( plot.GraphParent );
            int startIndex = 0;
            var xData = renderArgs.RelativeData[0];
            var yData = renderArgs.RelativeData[1];
            var renderTarget = renderArgs.RenderTarget;
            for( int i = 0; i < _colorRanges.Length - 1; ++i ) {
                // Draw all data below the current range with the associated color.
                int endIndex = startIndex;
                double range = _colorRanges[i].Item2;
                double offset = dataMapper.Map( range );
                while( endIndex < xData.Size && xData[endIndex] <= offset )
                    ++endIndex;
                RenderSegment( startIndex, endIndex, xData, yData, renderTarget, _rangeOptions[i] );
                startIndex = endIndex;
            // Draw all remaining data with the last color range.
            RenderSegment( startIndex, xData.Size, xData, yData, renderTarget, _rangeOptions.Last( ) );
        private static void RenderSegment( int startIndex, int endIndex, Buffer<double> xData, Buffer<double> yData, IRenderTarget renderTarget, RenderTargetOptions options ) {
            int length = endIndex - startIndex;
            if( length <= 0 )
                return;
            // Join current range with previous.
            if( startIndex > 0 ) {
                --startIndex;
                ++length;
            using( Buffer<double> xSegment = xData.Slice( startIndex, length ) )
            using( Buffer<double> ySegment = yData.Slice( startIndex, length ) )
                renderTarget.DrawLines( options, xSegment, ySegment );
~ Paul H

Similar Messages

  • How to create a "Custom Color" for highlighting? (Acrobat XI)

    March 10, 2014
    How to create a "Custom Color" for highlighting? (Acrobat XI)
    The numbers in the RGB and other fields change as various numbers are changed.
    I wanted to create a pale orange:
    Hue               13      Red      255
    Saturation   240      Green  177
    Luminosity    86       Blue     140
    I'd selected one of the orange squares in the color grid, to display the general orange area of the slider.
    I moved the slider to select a pale orange, which generated the above numbers.   Since this wasn't directly available to save to a Custom Color, I tried to  edit the numbers.  Unfortunately, the other numbers changed, making it impossible to actually create a color.
    Any suggestions would be appreciated.
    Note:  I used Techsmith's Snagit to show screen shots in a Word document.
    When I attempted to browse and upload the file, the error message said "[The content type of this image is not allowed.]"
    OK...what images *are* allowed?

    Hi Don,
    I saw Gilad answered your question in another forum post.
    Do you have everything you need at this point?
    Let me know if you need further assistance.
    Kind regards, Stacy

  • How do you set up a custom color for the standard screen mode

    This new colour scheme has not enough contrast for it to be readable, so I was pleased to find custom screen mode. However, there seems to be no way of setting up a custom color for this. In addition, the icons are so small they are unreadable. Is there any way of making them bigger. I have a 20" and a 22" monitor working together, but they are still not clear enough to use.

    Hi there
    Are you referring to the tool icons in Photoshop CS6? There are a few options you can change to help make the interface more readable, but unfortunately, there is not an option to enlarge the tool icons.
    It sounds like you may have discovered this already, but if you go to Photoshop > Preferences > Interface, you can change the color of the Photoshop CS6 interface.
    You can also enlarge the UI text size in this same window, in the Text preferences box.
    You can also make the size of your layers thumbnails larger. You can do this by clicking on the small menu in the upper right hand corner of the Layers Panel and selecting Panel Options.
    Here you can change the size of the layers thumbnails.
    I hope this helps you out a bit!

  • Can U Get Different Key Colors For pro 13"

    Can U Get Different Key Colors For pro 13"

    Can you do something in the javascript code where you have given specific IDs to each buttons in your menu? It could end up in something like "$('#menu_id').css('background-color', '#1B3E70');"
    Or, let say you have controls defined like thie:
    <body>
    <ul class="menu">
    <li class="menu-item"><a>item 1</a></li>
    <li class="menu-item"><a>item 2</a></li>
    <li class="menu-item"><a>item 3</a></li>
    </ul>
    </body>
    Can't you write at render stage this kind of actions by index:
    var i = $("li").index( $(this).parent() );
    if ( i === 1 ) {
    $('body').css('background', 'red');
    } else if ( i === 2 ) {
    $('body').css('background', 'green');
    } else {
    $('body').css('background', 'brown');

  • To create custom colors for exception

    Hi experts......
    I need to create custom colors for my report in order to set exceptions. Shades of red,yellow and green is just not enough for my client, they want to see blue as well when certain exception rises. Can someone please give me a hint as to how to implement that ...is it got to do st with the mime repository?
    Thnaks in advance!
    Tina

    Hi Tina,
    You can do this by formatting in the workbook. Run the query and in the workbook, on the BEx toolbar, there is a button for formatting. Select the exception cell whose color you want to change > in the Format button choos epatterns and select the color you would like. Once you have made the changes, save the workbook. The changes will remain in place the next time the user runs this workbook.
    Take a look at this link for more info:
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a559ee09411d2acb90000e829fbfe/content.htm
    Hope this helps...

  • Customizing Colors for a pie chat in webdynpro ABAP

    1. How to select different colors in pie chart for different categories?

    Hi Kishore you can customise your PIE chart if you are using the IGS.
    Chart designer
    You can customize the business graphics at the design time in view designer using the chart designer as well as the run time by using the interface u2018IF_WD_BUSIN_GRAPHICS_MTD_HNDLu2019 method. The chart designer will be called from the view designer by placing the cursor on the BG UI element and then right-click to select option u201CEdit Customizingu201D.
    check the following link on details of using Business Graphics in WD4A and at bottom there is customised editing step, which allows you flexibility to choose custom colors.
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ca932ebc-0901-0010-68a0-b4dd81a4bf81]
    Greetings
    Prashant

  • Custom colors for Keynote charts?

    I'm using the charts in Keynote for the first time, and I'm finding it surprising inflexible.
    As far as I can tell, I can not choose custom colors but have to choose between a few color sets chosen by Apple. Is that right?
    I would like 3 columns, with a 1, 2, 3 build order, in Red, White, and Blue. That seems pretty straightforward, but I can not see a way to make the red, white, and blue.
    thanks
    John
    PS: I really don't like the way that Jony Ives has imposed his personal preference for Helvetica Neue Light all over Apple products, applications, and websites.

    use the colour wheel to obtain million + colours:     Inspector > Format > Style > Fill

  • Setting custom color for selected node in JTree?

    Hi,
    i want to set my own color for selected node in JTree. i don't want to set for all the nodes...how to set Color for Selected node using TreeCellRender class?
    Thanks
    Mani

    I assume you are not setting a custom tree cell renderer...
    javax.swing.JTree theTree = ...;
    java.awt.Color newBGColor = ...;
    ((javax.swing.tree.DefaultTreeCellRenderer)theTree.getCellRenderer())
        .setBackgroundSelectionColor(newColor);

  • Customizing colors for the MotifLookAndFeel

    Hello,
    I am new to look and feels other than the default one.
    I am supposed to provide an application with a a Motif UI with a specific color scheme (colors of text, backgrounds, menus, etc.).
    Is there some API to configure Sun's MotifLookAndFeel colors?
    Other than that, here are the options I can list:
    1) System config file:
    I am not exactly good at Motif configuration but I guess Sun's MotifL&F bundled in the JRE will try to get the default colors from some motif.rsc or whatever it's called, in the user's home.
    However I don't want to alter this file as only my application should have custom colors, I don't want toi impact other Motif apps for the same user/host.
    2) UIDefaults:
    As I understand it, class UIDefaults represents a table provided by the installed LookAndFeel class, which can be changed afterwards, through the UIMAnager class. However, that doesn't force the L&F to take the changes into account. Indeed the MotifL&F doesn't seem to take any of those changes into account.
    3) Custom MotifL&F subclass
    I assume I could also subclass com.sun.java.swing.plaf.motif.MotifLookAndFeel and override getUIDefaults(), but that seems awkward just to change a handful of colors and no behavior.
    I'm not even sure MotifLookAndFeel fetches the color values from UIDefaults once it has initialized it...
    Any other suggestion?

    Thanks but I don't feel at ease with this solution (extending a class to change its configuration, whereas the base class can be configured through a public API).
    However your suggestion to peek a the code truly helped me: the names of the keys I was using in UIDefaults were simply wrong! :o)
    Actually I got a list of keys from this page: http://java.sun.com/products/jfc/tsc/articles/lookandfeel_reference/index.html , but in the source for the sun.java.swing.plaf.motif classes you can see the "correct" keys (e.g. MotifMenuItemUI extends BasicMenuItemUI which uses "MenuItem.background" and not "menu").
    The other good news is that the keys can be set beforehand (before actually setting the LaF): although the LaF provides its own UIDefaults, the UIManager stores them in a MultiUIDefaults, and the defaults installed via UIManager seem to take precedence...
    That was more convenient in my case.
    For reference here is an extract of my code:
    UIManager.put("menu", new ColorUIResource(0,250,20)); // helpless, wrong key
    UIManager.put("menutext", new Color(200,0,200)); // helpless
    UIManager.put("MenuItem.background", new Color(255,50,20)); // taken into account
    UIManager.put("Panel.background", new Color(166,255,166)); // taken into account
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");Just for convenience, does anyone know a good Web resource for the keys used by the various LookAndFeel classes, or at least the BasicLookAndFeel? Other than looking at the code for all XxxUI classes, of course :o)

  • SLA Custom source for Receivable Tax line

    Hi All,
    I defined a custom source with a cutstom funtion. I have taken paramter as 'Distribution Line Identifier' and did some logic to extract a value
    I have NOT entered any values to Segment, Lookup and Valueset.
    Next I developed custom Account derivation rule, selecting Value set into the 'Output type' (I have taken same value set as the line of business valueset)
    Into the priorities I have taken the above custom source
    Now in Journal Line Definitions for my required definition and required line type
    i tried to assign the above custom rule to line of business segment
    Here I could not find my custom rule at all.
    I did same way for Payables, it is working fine. Not sure where I did the worng.
    If I have to select 'Segment' options in custom source. I could not find line of business option in lov.
    Please let me know what I have to do with this.
    Thanks in advance
    Edited by: DharV on Aug 30, 2012 10:25 PM

    From the window help of JLD / JLT / ADR assignment screen:The list of values includes the following:All account derivation rules associated with the application for which the journal lines definition is created
    Sources that belong to the event class for which the line assignment is created and which meet the conditions described in the table below.Check all the sources used in custom source and ADR are related to the event class of the JLD, to which you are assigning the ADR.By
    Vamsi

  • UITableView: set different background colors for header and the table

    I would like to set my background color for my UITableView to white and set my tableViewHeader backgroundColor to grayColor similar to the facebook app. When I bounce scroll my table so that you can see above the header, then currently it is white above the header view. I want that to be brown instead.
    In the facebook app, above the headerview, it is a blue color and below the table is a white color. If i try and set the UITableView backgroundColor to brown, then the top will be brown, but so will the bottom. Additionally, all of the unset cells will have a brown background instead of white.
    Any help with this?

    Fixed..

  • Custom color for navigation bar

    I am struggling to find a way to make my navigation bar color different that supported colors.
    SDK supports default style i.e. blue, black and black opaque. I know it is possible cause there so many apps doing so. For example midomi.
    I have searched this forum already but haven't found working solution. If anybody knows how to do it would be grateful if he points me to the solution.

    tintColor property
    [https://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavi gationBar_Class/Reference/UINavigationBar.html]

  • Different Background Colors for Clients

    Maybe this isn't the right forum for this but how do you change the background color of ECC to change based on the client you select?

    Hello,
    As far as I know the colour settings are user based. On the top of SAP screen you will have a button with options, where you can change colour of the screen. If you want to get the colour of the screen based on the SAP, please speak to basis team and they should able to help you out.
    Regards,
    Ravi

  • Set custom colors for ONE particular window

    Hi, I often need to compare two files, say a "good, or sample" one, with a "bad, or in preparation".
    They both have the same name (like web.config CV.docx, MyClass.cs), so when I visualize them, I cannot distinguish easily whioch is which.
    For example, I see two notepad instances displaying "web.config" in title bar, which is which?
    Of course I could rename them, but I only want to view, not to modify anything, as that could be dangerous (oops! renamed wrong web.config)
    I tried to create two users "bluethemeuser" and "greenthemeuser", then shift run as different user, but this is tedious, and does not work (does not honor other user settings).
    I am loking for a way to tell a window "now you have a blue background until you are closed"
    any idea?

    Having a tag or a post-it, or even a spider ;-) in the window would be just as good.
    In IE you can use the Developer Tools to change the Title, which would change the Tab label.  F12, Ctrl-2,  document.Title="Demo"   In IE11 we even have IntelliSense to reduce the amount of keystrokes.
    Coincidentally I recently discovered a tool on the Windows SDK called
    Inspect.exe.  If you could find a way of extending that perhaps you could give any window any title you wanted?  Or add notes to hidden fields?
    Heh.  For my Demo tab.  Inspect says there could be Other Props:  I wonder how?
    Robert Aldwinckle

  • Different Backgound color for required Items

    Hi Experts,
    Is there a way to format the query data entry screens to change the back ground to a different color if the field is a required field.
    Thank you.

    Hi,
    no this is not possible. In case of using the Web you could do modifications in the program.
    Heike

Maybe you are looking for

  • Latest update to iPad has lagging issues with typing, how do i fix this?

    My son's iPad was just updated to OS7.1 and eve since  then his type functions will not work on the device. I have tried reseting the device and turing off the document setting in ICLOUD. Neither of these solutions worked. I am concerned that forms s

  • Windows 7 and Offline Files - Sync at logoff

    All, I have set up folder redirection in my organisation (testing purposes) The problem I am facing is Windows 7 will not automatically sync offline files back to the share. There is a gpo for Windows XP to do this when a user is either is logging of

  • Getting billed for free apps

    WHy is this happening. The app says free but after I get it I get an email sayin I am being charged..

  • LabView Control System Engineer Job Opening - Seattle

    LabView Control System Engineer Job Opening - Seattle Seattle Safety is looking for a qualified individual to fill an opening for Software Controls Engineer.  Seattle Safety designs, manufactures, and installs advanced crash test sled systems that ar

  • Validation problem when update a row in OAF

    created a application using OAF. No problem to create a row, when tried to update the row, received the following error message: oracle.jbo.RowValException: JBO-27012: Row validation method validation() failed for row with key oracle.jbo.Key 2) Steps