Solved

Help with a kendo chart

Posted on 2014-09-22
5
308 Views
Last Modified: 2014-09-22
Hello,

I need a little help with a kendo chart.  I have attached my "attempt" below.

What i am trying to do is have a bar chart with 12 bars each with a single value.  I need to give each bar a seperate colour.  An example is shown below.

I am trying to separate my data from everything else such as the bar colours.  

I am not a JS expert, or kendo expert!, and i can't seem to get the chart working.  I think i am 80% there but there is an error(s) in the code.

How it should look
<script>
 
  var  zdata = 
                [{"name": "Vanföreställningar", "data": "4"},
                {name: "Hallucinationer", data: [4]},
	{name: "Agitation/aggressivitet",data: [9]},
                {name: "Depression/dysfori", data: [4]},
                {name: "Ångest", data: [2]},
                {name: "Eufori/upprymdhet", data: [1]},
                {name: "Apati/likgiltighet", data: [9]},
                {name: "Hämningslöshet", data: [6]},
                {name: "Irritabilitet/labilitet", data: [4]},
                {name: "Motorisk av. beteende",data: [2]},
                {name: "Sömn", data: [4]},
                {name: "Aptit/ätstörningar", data: [12]}] ;

  
$("#chart").kendoChart({

  categoryAxis: { field: "name"},
  datasource:{data: zdata},
  series: [{field: "data" }],

  seriesColors: ["STEELBLUE", "FIREBRICK", "GOLD", "LIGHTBLUE", "INDIANRED", "DIMGREY", "MEDIUMBLUE", "POWDERBLUE",  "GREY", "MEDIUMVIOLETRED", "GREEN","SKYBLUE" ],
	legend: { visible: true, position: "bottom" }}
                      );
</script>

Open in new window

0
Comment
Question by:soozh
  • 2
  • 2
5 Comments
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 40336557
Have you tried putting quotes around the fields in the zdata JSON?
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 40336727
http://jsfiddle.net/9VZdS/342/

  $("#chart").kendoChart({
      series: [{
          name: "Vanföreställningar",
          data: [3]
      }, {
          name: "Hallucinationer",
          data: [4]
      }, {
          name: "Agitationaggressivitet",
          data: [9]
      }, {
          name: "Depression/dysfori",
          data: [4]
      }, {
          name: "Ångest",
          data: [2]
      }, {
          name: "Eufori/upprymdhet",
          data: [1]
      }, {
          name: "Apati/likgiltighet",
          data: [9]
      }, {
          name: "Hämningslöshet",
          data: [6]
      }, {
          name: "Irritabilitet/labilitet",
          data: [4]
      }, {
          name: "Motorisk av. beteende",
          data: [2]
      }, {
          name: "Sömn",
          data: [4]
      }, {
          name: "Aptit/ätstörningar",
          data: [12]
      }],
      seriesColors: ["STEELBLUE", "FIREBRICK", "GOLD", "LIGHTBLUE", "INDIANRED", "DIMGREY", "MEDIUMBLUE", "POWDERBLUE", "GREY", "MEDIUMVIOLETRED", "GREEN", "SKYBLUE"],
      legend: {
          position: "bottom"
      }
  });

Open in new window


Couldn't get it to work using a datasource
0
 

Author Comment

by:soozh
ID: 40337265
ok thanks.  How would i update the chart with new data?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40337343
Thats a different question.
0
 

Author Closing Comment

by:soozh
ID: 40337736
i guess you  have a point... see my next question.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question