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

custom colors for stock charts

2 Answers 78 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Jeffry
Top achievements
Rank 1
Jeffry asked on 17 Jan 2014, 11:03 PM
this is relative to this thread
http://www.kendoui.com/forums/kendo-ui-dataviz/chart/how-to-customise-color-of-bars-in-stock-chart.aspx#boMy966aG2OF1P8AAFTdxQ

i wasnt sure if you saw my response or not
so im repoosting

here is my stock chart code
$J($chartD).kendoStockChart({
    dataSource: wData,
    series: [{
        type: "candlestick",
        openField: "open",
        closeField: "close",
        highField: "high",
        lowField: "low",
        categoryField: "cat",
        colorField: "color",
  
        notes:{
            line: {
                width: 0,
                length: 0
            },
            label: {
                font: "bold 9px Open Sans, sans-serif"
            },
            icon: {
                border: {
                    width: 0
                }
            }
        },
  
        tooltip:{
            format: "{4}:<br /> {0:n0} -> {3:n0}"
        }
    }],
    navigator:{
        visible: false
    },
    categoryAxis:{
        categories: cats,
        type: "category",
        labels: {
            font: "bold 9px Open Sans, sans-serif",
            rotation: 90,
            step: 1,
            skip: 0
        }
    },
    valueAxis: {
        labels: {
            format: "N0"
        }
    }
});
here is a portion of the data as outputted by the console:

[Object, Object, Object, Object, Object, Object, Object, Object]
0: Object
cat: "2009"
close: 6831
color: "#75B5CD"
high: 6831
low: 0
noteText: 6831
open: 0
__proto__: Object
1: Object
cat: "Direct Hire"
close: 9185
color: "#4E503F"
high: 9185
low: 6831
noteText: 2354
open: 6831


however just by adding the colors im now getting a js err:
Uncaught TypeError: Object [object global] has no method 'forEach' 

without all the color stuff the chart works great
but i really want custom colors

can you give me ideas why this is happening
thanks!














2 Answers, 1 is accepted

Sort by
0
Jeffry
Top achievements
Rank 1
answered on 21 Jan 2014, 02:19 AM
heres some additional info:

if i do this: 
colorField: "wcolor",

then the chart renders but the colors dont change (makes sense)



if i do this:
colorField: "color",

then the chart doesnt render and i get this jquery err:
Uncaught TypeError: Object [object global] has no method 'forEach' 



even weirder - if i do this:
// colorField: "color",
(yes i comment out the color field)

then again i get the jquery err:
Uncaught TypeError: Object [object global] has no method 'forEach'

0
Iliana Dyankova
Telerik team
answered on 21 Jan 2014, 09:39 AM
Hello Jeffry,

Most probably there is some script which influences Kendo UI scripts. Could you please try removing all other scripts and let me know if the issue still persists?

On a side note, I used the provided configuration and prepared a simple jsBin example, however the chart is rendered as expected. 

Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Jeffry
Top achievements
Rank 1
Answers by
Jeffry
Top achievements
Rank 1
Iliana Dyankova
Telerik team
Share this question
or