Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chart library for Angular with two Y axis

Is there any library for Angular where I can plot two Y axis on the same graph (one on the left and the other on the right for example)? I tried libraries by chinmaymk and jtblin, but haven't found suitable method. Thanks.

like image 779
ivan.koval Avatar asked Mar 31 '15 17:03

ivan.koval


People also ask

How do you read a chart with two Y axis?

A second Y axis is a Y axis drawn on the right-hand side of a chart. It can show the same axis scale as the primary Y axis or a different scale. You can use a second Y axis with the same scale as the primary Y axis on a wide chart to help viewers interpret the data more easily.

Can a graph have two Y axis?

A dual y-axis chart allows you to summarize or plot two y-axis variables that have different domains. For example, you can plot the number of cases on one axis and the mean salary on another.

Which chart library is best for Angular?

FusionCharts is one of the leading open-source Angular chart libraries available. This is because it fulfills your data visualization needs and seamlessly integrates into your web applications. It also makes it easy to build your visualizations. FusionCharts gives you responsive charts that you can generate at runtime.


2 Answers

var chartData = {
            "type":"mixed",
            "title":{
                "text":"Multiple Y Axis"
            },
            "scale-x":{
                
            },
            "scale-y":{
                "values":"0:50:5"
            },
            "scale-y-2":{
                "values":"0:40000:5000",
                "guide":{
                    "visible":false
                }
            },
            "series":[
                {
                    "values":[8,31,12,40,24,20,16,40,9],
                    "type":"bar",
                    "scales":"scale-x,scale-y",
                    "hover-state":{
                        "visible":false
                    }
                },
                {
                    "values":[11254,26145,17014,2444,17871,25658,34002,26178,20413],
                    "type":"line",
                    "scales":"scale-x,scale-y-2"
                }
            ]
        };

zingchart.render({
  id: "chart",
  data: chartData,
  width: "100%"
 });
#chart {
  width: 100%;  
}
<script src="http://cdn.zingchart.com/zingchart.min.js"></script>
<div id="chart"></div>

ZingChart supports multiple y-axes with the scale-y-n objects. There's also an easy to use Angular directive on Github.

There's a simple demo in the snippet and here's a more real world example. You can right click the chart itself and select "View Source" to check out the JSON.

If you have any questions about implementation feel free to reach out - I'm on the ZC team.

like image 105
Jailbot Avatar answered Sep 20 '22 17:09

Jailbot


I've found n3-charts library that solves my problem.

like image 26
ivan.koval Avatar answered Sep 23 '22 17:09

ivan.koval