Alien Technology
Alien Technology

Reputation: 1838

How to display all points on an AmCharts stock chart without grouping using API

How can an AmChart stock chart be created using the API approach that does not combine all data items by day?

chart results

Using the API, the data points are always combined into a day, like this:

// API approach
var chart = new AmCharts.AmStockChart();
var dataSet = new AmCharts.DataSet();
...

https://codepen.io/AlienTechnology/pen/ALKNGa?editors=0010

Using the JSON approach, a line graph can be created that does not group. Here is the same chart using JSON:

/// JSON approach
var chart = AmCharts.makeChart( "chartdiv", {
  "type": "stock",
   ...

https://codepen.io/AlienTechnology/pen/VKaNLP?editors=0010

Upvotes: 1

Views: 714

Answers (1)

gerric
gerric

Reputation: 2297

One good thing about the JSON approach is, that you find mistakes faster and easier.
And that's exact the thing that happened to you. Comparing both your codepens shows, that you appended the categoryAxesSettings to the panel and not to the chart (where it belongs to).

var caSettings = new AmCharts.CategoryAxesSettings();
caSettings.minPeriod = "mm";
caSettings.maxSeries = 0;
chart.categoryAxesSettings = caSettings;

Here's the working codepen.

Upvotes: 4

Related Questions