Solved

Help with a kendo chart

Posted on 2014-09-22
5
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 110

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reactjs with .NET 3 78
links not working 2 27
testing a web application for ipad on windows pc 3 41
How do I post more than 1 item to php backend 24 32
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
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.

730 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