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

H2 decouple category axis from values granularity

2 Answers 43 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Olivier
Top achievements
Rank 1
Olivier asked on 16 Oct 2015, 08:04 AM

Hi,

 

I am using a stockchart graph.  I understood how the granularity of the category axis is working and I set it to "Fit" in order to have a displayable amount of dates, regardless of the ​timespan of my data (which is variable).  However, the side effect of this is that not all values of my graph are displayed, but only those at the date steps that are computed by the graph based on my display width and time span.

How can I keep the category axis working as it does, but have all values displayed on the graph. 

I have customized the tooltip to display the value and the precise date/time, so you will get the date/time info in this way even if not displayed on the category axis.

 

Thanks for your help.

Olivier

2 Answers, 1 is accepted

Sort by
0
Olivier
Top achievements
Rank 1
answered on 16 Oct 2015, 08:09 AM

In attachment, a screenshot illustrating the current situation.  Here is the corresponding code:

 

Html.Kendo().StockChart<FundGraphSample.Models.VNIHistory>()
        .Name("VNIHistory")
        .ChartArea(chartArea => chartArea.Background("#fafafa"))
        .DataSource(ds => ds.Read(read => read
            .Action("_VNIJsonData", "VNIData")
        ))
        .DateField("Date")
        .CategoryAxis(axis => axis
            .Name("displayedCategories")
            .Date()
            .BaseUnit(ChartAxisBaseUnit.Fit)
            .Crosshair(hair => hair
                .Width(2)
                .Color("black")
            )
            .MajorTicks(tick => tick
                .Visible(true)
                .Size(10)
            )
            .Labels(labels => labels
                .DateFormats(formats => formats
                    .Days("dd/MM/yyyy")
                    .Months("MMM 'yy")
                    .Weeks("dd/MM/yyyy")                    
                )
                .Rotation("auto")
                .Font("normal 16px HelveticaNeueLT-Thin, \"Courier New\"")
                
            )
        )
        .Series(series => {
            series
                .Line(s => s.Value)
                .Color("#c5281c")
                .Markers(false)
                .Width(3);
        })
        .ValueAxis(axis => axis
            .Numeric()
            .Line(line => line
                .Width(0)
            )
            .Labels(labels => labels
                .Font("normal 16px HelveticaNeueLT-Thin, \"Courier New\"")
                
            )
        )
        .Tooltip(tooltip => tooltip
            .Template("#= kendo.format('{0:C3}', value)#<br/>#= kendo.format('{0:dd MMM yy}', category)#")
        )
        .Navigator(nav => nav
            .CategoryAxis(axis => axis
                .Date()
                .BaseUnit(ChartAxisBaseUnit.Days)
                .AutoBaseUnitSteps(step => step
                    .Days(1,7)
                )
                .Labels(labels => labels
                    .DateFormats(formats => formats
                        .Days("MMM yyyy"))
                    .Rotation("auto")
                    .Font("normal 16px HelveticaNeueLT-Thin, \"Courier New\"")
                
                )
            )
            .Series(series => {
                series.Line(s => s.Value).Color("#c5281c").Markers(false).Width(1);
            })
            .Select(
                DateTime.Parse("2014/10/16"),
                DateTime.Parse("2015/10/15")
            )
        )​

0
Iliana Dyankova
Telerik team
answered on 20 Oct 2015, 06:55 AM
Hi Olivier,

I am afraid what you are trying to achieve is not supported - by design the data for a particular date period is aggregated and this behavior cannot be prevented. Please excuse us for any inconvenience this may cause.

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
Olivier
Top achievements
Rank 1
Answers by
Olivier
Top achievements
Rank 1
Iliana Dyankova
Telerik team
Share this question
or