Skip to Content
author's profile photo Former Member
Former Member

viz frame - line diagramm / set color to feed item

Hi Experts,

how can I set a specific colour to a feed item...

see example below - the feed FEED1 should have RED and the feed FEED2 the color BLUE.

Thanks for support.

BR,

Chrisotph

var feedPrimaryValues = new sap.viz.ui5.controls.common.feeds.FeedItem(

{

'uid' : "valueAxis",

'type' : "Measure",

'values' : [ "FEED1", "FEED2" ]

});

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Nov 20, 2015 at 08:21 AM

    Please check below code. it should be useful :


    var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({

    'uid': "valueAxis",

    'type': "Measure",

    'values': ["Item Category" , "Temperature in C"]

    }),

    feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({

    'uid': "categoryAxis",

    'type': "Dimension",

    'values': ["City"]

    });

    feedColor = new sap.viz.ui5.controls.common.feeds.FeedItem({

    'uid': "color",

    'type': "Dimension",

    'values': ["City"]

    });

    oVizFrame.setVizProperties({

    valueAxis: {

    label: {

    formatString: 'u'

    }

    },

    toolTip : {

    visible : false

    },

    plotArea: {

    colorPalette : ['#0000ff','#ffffff']

    },

    legend: {

    visible: false,

    title: {

    }

    },

    yAxis : {

    isIndependentMode : false,

    gridline : {

    visible : false,

    showFirstLine : false,

    showLastLine : true,

    type : sap.viz.ui5.types.Axis_gridline_type.line

    }

    },

    title: {

    visible: true,

    text: 'Temperature in C by City and Item Category'

    }

    });

    oVizFrame.addFeed(feedValueAxis);

    oVizFrame.addFeed(feedCategoryAxis);

    },

    removePopup :function(oEvent) {

    debugger;

    }

    Kindly let me know if you need any more information

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hey

      You can't attach a colour to a feedItem that I know of. And to be quite honest it makes perfect sense why the option isn't available. If each feedItem had a different colour the results would be weird. One would want the bars representing different entities to each be a different colour and explained in the key legend. Vijay Kumar Kalluri's colorPallette is the way to go. Add the colorPalette line to his JS Bin example:

      plotArea: {

      dataLabel: {

      visible: true,

      formatString: "#,##0"

      },

      colorPalette : ['red','green'] // <- Add this line

      },

      How this works is while building the chart, it notices, "Hey, I need a colour" and then it takes the first available colour in the specified colorPalette. In this case it will be red. Thus the first bar drawn will be red 😊. Then for the next bar it sees "I need another colour" and makes the next bar green. When it wants a third colour for the third bar it starts at the beginning of the palette again and makes 2 different entities red, because it ran out of colours (so in this case it loops - palette's in real life are roundish anyway).

      So if you have several entities you want to group by some other entity. You need as many colours as entities you want to group on. The first entity will be the first colour in palette specified, etc

      So with this your "FEED1" will be red and your "FEED2" will be green.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.