This is a migrated thread and some comments may be shown as answers.

How to draw bar chart using various color

3 Answers 142 Views
Charts
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Min
Top achievements
Rank 1
Min asked on 20 Jan 2012, 03:53 AM
Hi telerik team,

I drew bar chart using basic bar chart sample codes. But I wanna draw bar chart with various colors.
I used stack option and It works. But num value cannot be used like next codes.
Can't I use num value like '1' in X: "1" or  '1':15.7 ?
It occurs errors like attacted file.
Please tell me how to make codes. ^^

<script>
                function createChart() {
    var chartData = [
   { X: "1" , '1':15.7, '2': 0, '3': 0, '4': 0, '5':0},
   { X: "2" , '2':16.7, '1': 0, '3': 0, '4': 0, '5':0},
   { X: "3" , '3':20,   '1': 0, '2': 0, '4': 0, '5':0},
   { X: "4" , '4':23.5, '1': 0, '2': 0, '3': 0, '5':0},
   { X: "5" , '5':26.6, '1': 0, '2': 0, '3': 0, '4':0}
];
                    $("#chart").kendoChart({
     dataSource: {
      data: chartData
   },
                        theme: $(document).data("kendoSkin") || "default",
                        title: {
                            text: "Internet Users"
                        },
                        legend: {
                            position: "bottom"
                        },
                        seriesDefaults: {
                            type: "column",
       stack: true
                        },
                        series:
       [
        { field:"1",  name: "1", color:"red" },
        { field:"2",  name: "2" },
        {   field:"3",  name: "3"     },
        { field:"4",  name: "4" },
        {   field:"5",  name: "5" }
       ],
                        valueAxis: {
                            labels: {
                                format: "{0}%"
                            }
                        },
                        categoryAxis: {
                            field:'X'
                        },
                        tooltip: {
                            visible: true,
                            format: "{0}%"
                        }
                    });
                }

                $(document).ready(function() {
                    setTimeout(function() {
                        createChart();

                        // Initialize the chart with a delay to make sure
                        // the initial animation is visible
                    }, 400);

                    $(document).bind("kendo:skinChange", function(e) {
                        createChart();
                    });
                });
            </script>

3 Answers, 1 is accepted

Sort by
0
Joe Sugden
Top achievements
Rank 1
answered on 24 Feb 2012, 02:53 PM
How do I make same series bars to be various colors?

Thanks!
0
T. Tsonev
Telerik team
answered on 29 Feb 2012, 08:01 AM
Hello,

This is not currently possible with the bar series. It's been on our to-do list for some time now and we'll keep it in mind during our planning for the next release.

Apologies for the caused inconvenience.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Min
Top achievements
Rank 1
answered on 29 Feb 2012, 08:32 AM
no~ no~ it's ok. I found it using stacked option. It worked. Thank you! ^^
Tags
Charts
Asked by
Min
Top achievements
Rank 1
Answers by
Joe Sugden
Top achievements
Rank 1
T. Tsonev
Telerik team
Min
Top achievements
Rank 1
Share this question
or