Solved

Help with a kendo chart

Posted on 2014-09-22
5
300 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 108

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
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.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now