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

Stockchart: Line and Volume in same pane

10 Answers 45 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 29 Jul 2016, 08:42 AM

Hi,

the example http://demos.telerik.com/aspnet-mvc/financial/panes show how to plot the volume in a second pane.

How can I plot Line + Volume in one pane? Similar: http://finance.yahoo.com/chart/aapl

Peter

10 Answers, 1 is accepted

Sort by
0
Accepted
Danail Vasilev
Telerik team
answered on 02 Aug 2016, 06:20 AM
Hi Peter,

You can simply remove the panes - http://dojo.telerik.com/UBaNe

Regards,
Danail Vasilev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 05 Aug 2016, 05:45 AM

Hi Danail,

Thank you, it works in a pane.

But the Volume Bar Chart should only in the lower partt (~30%). I can set the maximum of the axis to a value.

But how can I set it  automatic to 30%  of Max of Volme data?

Also the navigator time frame is set static to

select: {
                        from: "2009/02/05",
                        to: "2011/10/07"
                    }

Can I set it

to: Maximum Date of Data

from: to -- 2 Months

?

 

Regards,

Peter

 

0
Peter
Top achievements
Rank 1
answered on 05 Aug 2016, 07:58 AM

For the volumeAxis I modified a forum solution from Kendo Charts Minimum value for a Max of ValueAxis

<script type="text/javascript">
var initDefaults = kendo.dataviz.NumericAxis.fn.initDefaults;
kendo.dataviz.NumericAxis.fn.initDefaults = function () {
     var defaults = initDefaults.apply(this, arguments);
     if (defaults.name == "volumeAxis ") {
         defaults.max = Math.ceil(defaults.max * 3 / 500) * 500; //30% of max & rund up to 500
         defaults.min=0
         defaults.majorUnit = defaults.max / 5; //5 ticks
     }
      return defaults;
 };
</script>

0
Danail Vasilev
Telerik team
answered on 08 Aug 2016, 08:38 AM
Hi Peter,

You can use the select method of the navigator in order to set the to/from values.

Regards,
Danail Vasilev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 08 Aug 2016, 09:08 AM

Yes I know,

but how can I get the maximum date maxdate of the stock dataset, so I can write to set the navigator to the last month of data

select: {
                       from: maxdate.setMonth(maxdate.getMonth() - 1),
                       to: lastdate
                    }

0
Peter
Top achievements
Rank 1
answered on 08 Aug 2016, 09:12 AM

would be nice  the forum has an edit option. The code:

select: {
    from: maxdate.setMonth(maxdate.getMonth() - 1),
    to:   maxdate
    }

0
Danail Vasilev
Telerik team
answered on 10 Aug 2016, 05:20 AM
Hello Peter,

To select all the data you can try to set a very small and very large values for the from/to properties. If you want, however, to get the min/max dates you can try the following:
     - Sort the data source by the date field:
$("#stock-chart").data("kendoStockChart").dataSource.sort({ field: "Date", dir: "asc" })
     - Get the min/max values for the date:
var min = $("#stock-chart").data("kendoStockChart").dataSource.view()[0].Date;
var max = $("#stock-chart").data("kendoStockChart").dataSource.view()[$("#stock-chart").data("kendoStockChart").dataSource.view().length-1].Date;


Regards,
Danail Vasilev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 10 Aug 2016, 10:12 AM

Hello Danail,

thank you. I  tested also dataSource.view() but the values are not sorted.
And I didn't found in the Kendo API documentaion dataSource the  method sort({ field: "Date", dir: "asc" })

The docu is every poor:
dataSource - Object
DataSource configuration or instance.

Which object? With google I found kendo.data.DataSource . A link would be very useful.

Regards,

Peter

 

0
Accepted
Danail Vasilev
Telerik team
answered on 11 Aug 2016, 10:47 AM
Hi Peter,

Did you try the provided sample because it works properly on my side For example by executing it over this demo - http://demos.telerik.com/kendo-ui/financial/index

Regarding the sort method I had already provided a link to it in my previous post - http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-sort

Regards,
Danail Vasilev
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 11 Aug 2016, 03:05 PM

Yes, I found it. It would be helpfull if there is a link from

http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/stock-chart#configuration-dataSource

dataSource Object
DataSource configuration or instance.

to docs.telerik.com/kendo-ui/api/javascript/data/datasource

Peter

 

 

 

Tags
Chart
Asked by
Peter
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Peter
Top achievements
Rank 1
Share this question
or