How to set AnyChart Candlestick colors dynamic?











up vote
0
down vote

favorite












I want to set Candlestick Colors dynamically. But i don't know how.



So i passed the Parameter true as said on anychart Doc to anychart.stock
constructor und defined a field caled color on Dataset with mapped field
as example showed below.



Anyone get a Solutions ?



Ref to Dok: https://docs.anychart.com/Stock_Charts/Data#individual_point_settings



anychart.onDocumentReady(function() {

// create a data table
var table = anychart.data.table('x');
// add data
table.addData([{
'x': '2015-12-24',
'open': 511.53,
'high': 514.98,
'low': 505.79,
'close': 506.40,
'fill': '#00FF00'
}]);

// create a stock chart
var chart = anychart.stock(true);

// create a mapping
var mapping = table.mapAs({
'open': 'open',
'high': 'high',
'low': 'low',
'close': 'close',
'fill': 'fill'
});

// add a series using the mapping
chart.plot(0).candlestick(mapping).name('ACME Corp.');

// set container id for the chart
chart.container('container');

// initiate chart drawing
chart.draw();
});









share|improve this question




























    up vote
    0
    down vote

    favorite












    I want to set Candlestick Colors dynamically. But i don't know how.



    So i passed the Parameter true as said on anychart Doc to anychart.stock
    constructor und defined a field caled color on Dataset with mapped field
    as example showed below.



    Anyone get a Solutions ?



    Ref to Dok: https://docs.anychart.com/Stock_Charts/Data#individual_point_settings



    anychart.onDocumentReady(function() {

    // create a data table
    var table = anychart.data.table('x');
    // add data
    table.addData([{
    'x': '2015-12-24',
    'open': 511.53,
    'high': 514.98,
    'low': 505.79,
    'close': 506.40,
    'fill': '#00FF00'
    }]);

    // create a stock chart
    var chart = anychart.stock(true);

    // create a mapping
    var mapping = table.mapAs({
    'open': 'open',
    'high': 'high',
    'low': 'low',
    'close': 'close',
    'fill': 'fill'
    });

    // add a series using the mapping
    chart.plot(0).candlestick(mapping).name('ACME Corp.');

    // set container id for the chart
    chart.container('container');

    // initiate chart drawing
    chart.draw();
    });









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I want to set Candlestick Colors dynamically. But i don't know how.



      So i passed the Parameter true as said on anychart Doc to anychart.stock
      constructor und defined a field caled color on Dataset with mapped field
      as example showed below.



      Anyone get a Solutions ?



      Ref to Dok: https://docs.anychart.com/Stock_Charts/Data#individual_point_settings



      anychart.onDocumentReady(function() {

      // create a data table
      var table = anychart.data.table('x');
      // add data
      table.addData([{
      'x': '2015-12-24',
      'open': 511.53,
      'high': 514.98,
      'low': 505.79,
      'close': 506.40,
      'fill': '#00FF00'
      }]);

      // create a stock chart
      var chart = anychart.stock(true);

      // create a mapping
      var mapping = table.mapAs({
      'open': 'open',
      'high': 'high',
      'low': 'low',
      'close': 'close',
      'fill': 'fill'
      });

      // add a series using the mapping
      chart.plot(0).candlestick(mapping).name('ACME Corp.');

      // set container id for the chart
      chart.container('container');

      // initiate chart drawing
      chart.draw();
      });









      share|improve this question















      I want to set Candlestick Colors dynamically. But i don't know how.



      So i passed the Parameter true as said on anychart Doc to anychart.stock
      constructor und defined a field caled color on Dataset with mapped field
      as example showed below.



      Anyone get a Solutions ?



      Ref to Dok: https://docs.anychart.com/Stock_Charts/Data#individual_point_settings



      anychart.onDocumentReady(function() {

      // create a data table
      var table = anychart.data.table('x');
      // add data
      table.addData([{
      'x': '2015-12-24',
      'open': 511.53,
      'high': 514.98,
      'low': 505.79,
      'close': 506.40,
      'fill': '#00FF00'
      }]);

      // create a stock chart
      var chart = anychart.stock(true);

      // create a mapping
      var mapping = table.mapAs({
      'open': 'open',
      'high': 'high',
      'low': 'low',
      'close': 'close',
      'fill': 'fill'
      });

      // add a series using the mapping
      chart.plot(0).candlestick(mapping).name('ACME Corp.');

      // set container id for the chart
      chart.container('container');

      // initiate chart drawing
      chart.draw();
      });






      javascript web candlestick-chart anychart






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 7 at 12:53









      Gaspacchio

      711218




      711218










      asked Nov 7 at 12:21









      Nex Tronic

      11




      11
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Your approach was absolutely right! The only problem was that candlestick series has no 'fill' setting, it has risingFill and fallingFill. So, all you need is to map it using these settings. You can check the working sample based on your code in the comment below. Also, you can learn more about candlestick settings in this article.






          share|improve this answer





















          • playground.anychart.com/0LSrr297
            – AnyChart Support
            Nov 12 at 4:00










          • Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
            – Nex Tronic
            Nov 19 at 18:20











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53189389%2fhow-to-set-anychart-candlestick-colors-dynamic%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          Your approach was absolutely right! The only problem was that candlestick series has no 'fill' setting, it has risingFill and fallingFill. So, all you need is to map it using these settings. You can check the working sample based on your code in the comment below. Also, you can learn more about candlestick settings in this article.






          share|improve this answer





















          • playground.anychart.com/0LSrr297
            – AnyChart Support
            Nov 12 at 4:00










          • Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
            – Nex Tronic
            Nov 19 at 18:20















          up vote
          0
          down vote













          Your approach was absolutely right! The only problem was that candlestick series has no 'fill' setting, it has risingFill and fallingFill. So, all you need is to map it using these settings. You can check the working sample based on your code in the comment below. Also, you can learn more about candlestick settings in this article.






          share|improve this answer





















          • playground.anychart.com/0LSrr297
            – AnyChart Support
            Nov 12 at 4:00










          • Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
            – Nex Tronic
            Nov 19 at 18:20













          up vote
          0
          down vote










          up vote
          0
          down vote









          Your approach was absolutely right! The only problem was that candlestick series has no 'fill' setting, it has risingFill and fallingFill. So, all you need is to map it using these settings. You can check the working sample based on your code in the comment below. Also, you can learn more about candlestick settings in this article.






          share|improve this answer












          Your approach was absolutely right! The only problem was that candlestick series has no 'fill' setting, it has risingFill and fallingFill. So, all you need is to map it using these settings. You can check the working sample based on your code in the comment below. Also, you can learn more about candlestick settings in this article.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 12 at 4:00









          AnyChart Support

          1,4701511




          1,4701511












          • playground.anychart.com/0LSrr297
            – AnyChart Support
            Nov 12 at 4:00










          • Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
            – Nex Tronic
            Nov 19 at 18:20


















          • playground.anychart.com/0LSrr297
            – AnyChart Support
            Nov 12 at 4:00










          • Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
            – Nex Tronic
            Nov 19 at 18:20
















          playground.anychart.com/0LSrr297
          – AnyChart Support
          Nov 12 at 4:00




          playground.anychart.com/0LSrr297
          – AnyChart Support
          Nov 12 at 4:00












          Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
          – Nex Tronic
          Nov 19 at 18:20




          Thx you very much. Your Solution works perfektly! With the mapped Falling Fill, Rising Fill all work as expected for me.
          – Nex Tronic
          Nov 19 at 18:20


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53189389%2fhow-to-set-anychart-candlestick-colors-dynamic%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Academy of Television Arts & Sciences

          L'Équipe

          1995 France bombings