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

how to adjust area chart for non records?

2 Answers 31 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
toy
Top achievements
Rank 1
toy asked on 21 May 2013, 12:55 AM
hi
i have a dataSource that spits out data like this:
 
after feb - the 'budget' MDetail falls off to 0
and before jun - i dont know what the 'projected' MDetail does
its drawing a bunch of stuff
 
what im trying to achieve here is:
if there are no records for anything after feb
then dont draw anything - just cut it off
ie dont descend to 0
 
and likewise if there are no records for the beginning
then dont draw anything until theres a record for the category
ie it iwll be blank until jun and then the 'projected' numbers start drawing
 
how do i do this?
 
thanksa!

[{
Amount: "2140402000"
MDetail: "Budget"
Month: "Jan"
Monthnum: "1"
Year: "2013"
},
{
Amount: "2146823206"
MDetail: "Budget"
Month: "Feb"
Monthnum: "2"
Year: "2013"
},
{
Amount: "2257798847"
MDetail: "Projected"
Month: "Jun"
Monthnum: "6"
Year: "2013"
},
{
Amount: "2272474540"
MDetail: "Projected"
Month: "Jul"
Monthnum: "7"
Year: "2013"
}]

and the chart markup looks like htis
$J("#chart").kendoChart({
    dataSource: {
        data:source,
        group: {
            field: "MDetail",
            dir: "asc"
        },
        sort: [
            {field: "Year", dir: "asc"},
            {field: "Monthnum", dir: "asc"}
        ]
    },
    theme: "blueOpal",
    title: {
        text: "Total Cost of Workforce for " + year
    },
    legend: {
        position: "bottom"
    },
    seriesDefaults: {
        type: "area",
        format: "${0:0,000}"
    },
    series: [{
        field: "Amount",
        groupNameTemplate: "#= group.value # "
    }],
    valueAxis: {
        labels: {
            template: "#= kendo.format('$ {0:N0}', value / 1000000) # M"
        },
        majorUnit: 100000000,
        line: {
            visible: false
        },
        axisCrossingValue: -10
    },
    categoryAxis: {
        field: "Month",
        majorGridLines: {
            visible: false
        }
    },
    tooltip: {
        visible: true,
        format: "$ {0:0,000}"
    }
});


2 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 21 May 2013, 11:09 AM
Hi Toy,

I already replied to the same question in your other thread, however I am pasting my reply here too so the other users who are following this thread can read it:

I am not quite sure if I understand your scenario correctly. Could you please elaborate a bit more on the exact outcome you are expecting? This way I would be able to advice you further and provide concrete recommendations.

On a side note, have in mind the following points: 

  • In a grouped chart the categoryAxis's labels are created depending on the first group. I.e. with the provided configuration on the categoryAxis will be displayed the "Month" for "Budget" group;
  • Categorical charts (area, column, bar etc.) require a matching set of data points (the value can be null but the record need to be presented in the data). This is due to the fact that series.data is an array

Also, I observed that in data array the "Amount" field contains string values while the Chart expects number.

Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
toy
Top achievements
Rank 1
answered on 22 May 2013, 07:39 PM
hey iliana 
actually i sent you a reply with a mockup jpg of how i wanted my chart to look

i thought using a null value would solve the issue
but the null value does the same as with a zero value -
the chart creates a drop to the next increment on the category axis
whereas i would like it to not show anything at all my last proper value

im attaching the mockup again
Tags
General Discussions
Asked by
toy
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
toy
Top achievements
Rank 1
Share this question
or