How to parse another color to half of my dataset in chart.jsChartJS - Different color per data pointHow do I parse a string to a float or int?How do I redirect to another webpage?How to check if a string “StartsWith” another string?How do I include a JavaScript file in another JavaScript file?How to move an element into another element?How do I parse XML in Python?How to parse JSON using Node.js?ASP.Net ASPxGridView OnHtmlDataCellPreparedChart.js v2 hide dataset labelsChartjs.org Chart only displaying in one page

If a spaceship ran out of fuel somewhere in space between Earth and Mars, does it slowly drift off to the Sun?

Why, even after his imprisonment, people keep calling Hannibal Lecter "Doctor"?

I transpose the source code, you transpose the input!

Avoiding dust scattering when you drill

How do my husband and I get over our fear of having another difficult baby?

Are the coefficients of certain product of Rogers-Ramanujan Continued Fraction non-negative?

What's the hidden joke/meaning behind "Don't drink and park - accidents cause people"?

Is a Middle Name a Given Name?

Is it ok if I haven't decided my research topic when I first meet with a potential phd advisor?

An impressive body of work

A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?

As a team leader is it appropriate to bring in fundraiser candy?

Why is STARTTLS still used?

Which altitudes are safest for VFR?

Create the same subfolders in another folder

How to prevent pickpocketing in busy bars?

Do interval ratios take overtones into account or solely the fundamental frequency?

I reverse the source code, you reverse the input!

Is determiner 'a' needed in "one would call such a value a constant"?

How to stop the death waves in my city?

What can Thomas Cook customers who have not yet departed do now it has stopped operating?

お仕事に学校頑張って meaning

Why would an airline put 15 passengers at once on standby?

Lost passport and visa, tried to reapply, got rejected twice. What are my next steps?



How to parse another color to half of my dataset in chart.js


ChartJS - Different color per data pointHow do I parse a string to a float or int?How do I redirect to another webpage?How to check if a string “StartsWith” another string?How do I include a JavaScript file in another JavaScript file?How to move an element into another element?How do I parse XML in Python?How to parse JSON using Node.js?ASP.Net ASPxGridView OnHtmlDataCellPreparedChart.js v2 hide dataset labelsChartjs.org Chart only displaying in one page






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















So, I would like to visualise half of my data in red while I would like the other half to be in green. With the current setup, everything is in green. So my question is, how do I parse a red color to half of my dataset while the other half stays green, as it currently is? My dataset is a list consisting of 50 floats numbers which I parse to the function drawChart.



I've already tried to include a function that was explained in the following thread: ChartJS - Different color per data point but that didn't succeed yet. Any help would be greatly appreciated!



 var ctx = document.getElementById("myChart");
ctx.style.backgroundColor = 'rgb(21,43,42)';
var myChart = new Chart(ctx,
type: 'bar',
data:
labels: x,
datasets: [

label: 'Initial',
data: y,
backgroundColor: "rgba(58, 98, 87, 0.5)"
,
label: 'Profit',
data: z,
backgroundColor: "rgba(51, 204, 51, 0.9)"

]
,
options:
legend:
display: false
,
scales:
xAxes: [
gridLines:
display: false
,
stacked: true,
display: true,
scaleLabel:
display: true,
labelString: w,
fontSize: 16,
fontColor: 'white'
,
ticks:
fontColor: 'white'

],
yAxes: [
gridLines:
color: 'rgba(153,153,153,0.2)'
,
stacked: true,
display: true,
scaleLabel:
display: true,
labelString: "Order size",
fontSize: 16,
fontColor: 'white'
,
ticks:
fontColor: 'white'

]
,
tooltips:
displayColors: false,
callbacks:
title: function(tooltipItem)
return `$w: $String(tooltipItem[0].xLabel)`;
,
label: function(tooltipItemY)
return "Total: " + `$Number(tooltipItemY.yLabel)`;




);
for (i = 0; i < myChart.data.datasets[0].data.length; i++)
if (myChart.data.datasets[0].data[i] > 25)
y.backgroundColor.push("#90cd8a");
else
y.backgroundColor.push("#f58368");


};```









share|improve this question






























    0















    So, I would like to visualise half of my data in red while I would like the other half to be in green. With the current setup, everything is in green. So my question is, how do I parse a red color to half of my dataset while the other half stays green, as it currently is? My dataset is a list consisting of 50 floats numbers which I parse to the function drawChart.



    I've already tried to include a function that was explained in the following thread: ChartJS - Different color per data point but that didn't succeed yet. Any help would be greatly appreciated!



     var ctx = document.getElementById("myChart");
    ctx.style.backgroundColor = 'rgb(21,43,42)';
    var myChart = new Chart(ctx,
    type: 'bar',
    data:
    labels: x,
    datasets: [

    label: 'Initial',
    data: y,
    backgroundColor: "rgba(58, 98, 87, 0.5)"
    ,
    label: 'Profit',
    data: z,
    backgroundColor: "rgba(51, 204, 51, 0.9)"

    ]
    ,
    options:
    legend:
    display: false
    ,
    scales:
    xAxes: [
    gridLines:
    display: false
    ,
    stacked: true,
    display: true,
    scaleLabel:
    display: true,
    labelString: w,
    fontSize: 16,
    fontColor: 'white'
    ,
    ticks:
    fontColor: 'white'

    ],
    yAxes: [
    gridLines:
    color: 'rgba(153,153,153,0.2)'
    ,
    stacked: true,
    display: true,
    scaleLabel:
    display: true,
    labelString: "Order size",
    fontSize: 16,
    fontColor: 'white'
    ,
    ticks:
    fontColor: 'white'

    ]
    ,
    tooltips:
    displayColors: false,
    callbacks:
    title: function(tooltipItem)
    return `$w: $String(tooltipItem[0].xLabel)`;
    ,
    label: function(tooltipItemY)
    return "Total: " + `$Number(tooltipItemY.yLabel)`;




    );
    for (i = 0; i < myChart.data.datasets[0].data.length; i++)
    if (myChart.data.datasets[0].data[i] > 25)
    y.backgroundColor.push("#90cd8a");
    else
    y.backgroundColor.push("#f58368");


    };```









    share|improve this question


























      0












      0








      0








      So, I would like to visualise half of my data in red while I would like the other half to be in green. With the current setup, everything is in green. So my question is, how do I parse a red color to half of my dataset while the other half stays green, as it currently is? My dataset is a list consisting of 50 floats numbers which I parse to the function drawChart.



      I've already tried to include a function that was explained in the following thread: ChartJS - Different color per data point but that didn't succeed yet. Any help would be greatly appreciated!



       var ctx = document.getElementById("myChart");
      ctx.style.backgroundColor = 'rgb(21,43,42)';
      var myChart = new Chart(ctx,
      type: 'bar',
      data:
      labels: x,
      datasets: [

      label: 'Initial',
      data: y,
      backgroundColor: "rgba(58, 98, 87, 0.5)"
      ,
      label: 'Profit',
      data: z,
      backgroundColor: "rgba(51, 204, 51, 0.9)"

      ]
      ,
      options:
      legend:
      display: false
      ,
      scales:
      xAxes: [
      gridLines:
      display: false
      ,
      stacked: true,
      display: true,
      scaleLabel:
      display: true,
      labelString: w,
      fontSize: 16,
      fontColor: 'white'
      ,
      ticks:
      fontColor: 'white'

      ],
      yAxes: [
      gridLines:
      color: 'rgba(153,153,153,0.2)'
      ,
      stacked: true,
      display: true,
      scaleLabel:
      display: true,
      labelString: "Order size",
      fontSize: 16,
      fontColor: 'white'
      ,
      ticks:
      fontColor: 'white'

      ]
      ,
      tooltips:
      displayColors: false,
      callbacks:
      title: function(tooltipItem)
      return `$w: $String(tooltipItem[0].xLabel)`;
      ,
      label: function(tooltipItemY)
      return "Total: " + `$Number(tooltipItemY.yLabel)`;




      );
      for (i = 0; i < myChart.data.datasets[0].data.length; i++)
      if (myChart.data.datasets[0].data[i] > 25)
      y.backgroundColor.push("#90cd8a");
      else
      y.backgroundColor.push("#f58368");


      };```









      share|improve this question














      So, I would like to visualise half of my data in red while I would like the other half to be in green. With the current setup, everything is in green. So my question is, how do I parse a red color to half of my dataset while the other half stays green, as it currently is? My dataset is a list consisting of 50 floats numbers which I parse to the function drawChart.



      I've already tried to include a function that was explained in the following thread: ChartJS - Different color per data point but that didn't succeed yet. Any help would be greatly appreciated!



       var ctx = document.getElementById("myChart");
      ctx.style.backgroundColor = 'rgb(21,43,42)';
      var myChart = new Chart(ctx,
      type: 'bar',
      data:
      labels: x,
      datasets: [

      label: 'Initial',
      data: y,
      backgroundColor: "rgba(58, 98, 87, 0.5)"
      ,
      label: 'Profit',
      data: z,
      backgroundColor: "rgba(51, 204, 51, 0.9)"

      ]
      ,
      options:
      legend:
      display: false
      ,
      scales:
      xAxes: [
      gridLines:
      display: false
      ,
      stacked: true,
      display: true,
      scaleLabel:
      display: true,
      labelString: w,
      fontSize: 16,
      fontColor: 'white'
      ,
      ticks:
      fontColor: 'white'

      ],
      yAxes: [
      gridLines:
      color: 'rgba(153,153,153,0.2)'
      ,
      stacked: true,
      display: true,
      scaleLabel:
      display: true,
      labelString: "Order size",
      fontSize: 16,
      fontColor: 'white'
      ,
      ticks:
      fontColor: 'white'

      ]
      ,
      tooltips:
      displayColors: false,
      callbacks:
      title: function(tooltipItem)
      return `$w: $String(tooltipItem[0].xLabel)`;
      ,
      label: function(tooltipItemY)
      return "Total: " + `$Number(tooltipItemY.yLabel)`;




      );
      for (i = 0; i < myChart.data.datasets[0].data.length; i++)
      if (myChart.data.datasets[0].data[i] > 25)
      y.backgroundColor.push("#90cd8a");
      else
      y.backgroundColor.push("#f58368");


      };```






      javascript python webview chart.js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 28 at 19:22









      ja_qahja_qah

      12 bronze badges




      12 bronze badges

























          0






          active

          oldest

          votes














          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',
          autoActivateHeartbeat: false,
          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/4.0/"u003ecc by-sa 4.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%2f55405403%2fhow-to-parse-another-color-to-half-of-my-dataset-in-chart-js%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405403%2fhow-to-parse-another-color-to-half-of-my-dataset-in-chart-js%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







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현