# Bar And Pie Charts

Popily is fundamentally different from other analytics products. Popily is not a chart-builder, but an advanced analytics service powered by our intelligent analytics engine, called “Maggie.”

With Popily, you do not construct the charts you want. Instead you tell Popily a relationship in your data that you are interested in, and Popily returns with a best-practice visualization accurately representing that relationship. Let's dive right into some examples to demonstrate the point.

Imagine we care about the relationship between sales and the type of product sold. What is the best practice for visualizing this relationship? With traditional analytics tools, you have to answer that question explicitly before writing a single line for code. With Popily, you never have to answer that question — just ask Popily for the average sales and product category, and recieve a best-practice interactive visualization of that relationship.

Want to see how easy that was? Here is the code used to generate the data visuzaliation above:

var insightOptions = {
source: 'sales-data',
columns: ['Sales', 'Product Category'],
calculations: [
{
column: 'Sales',
calculation: 'average'
}
]
};

popily.chart.getAndRender('#chart-1', insightOptions);

As you can plainly see, we were never forced to specify the type of chart or submit precalculated data. All we did was tell Popily the relationships we were interested in see, and in return we recieved a data visualization of that relationship.

We can see the power of Popily's intelligent analytics engine by asking for more complicated analyses. Imagine we are now interested in the average of sales of products in different categories and the types of customers who bought them. How best might this three dimensional relationship be displayed? With D3 and other charting libraries, you can't get started without answering that question. With Popily, the question is answered for you, all you need to do is specify the relationship you care about: sales, product category, and customer segment:

var insightOptions = {
source: 'sales-data',
columns: ['Sales', 'Product Category','Customer Segment'],
calculations: [
{
column: 'Sales',
calculation: 'average'
}
]
};

popily.chart.getAndRender('#chart-2', insightOptions);

And Popily returns the best practice data visualization for that relationship:

Now we can start to see the power of Popily's intelligent analytics engine. But we can take it farther, much farther. Using the example from above, now let's imagine that instead of the average sale, we want to look at the sum total of sales. How should this relationship be displayed differently than an average of sales? Again, Popily intelligently decides for you:

var insightOptions = {
source: 'sales-data',
columns: ['Sales', 'Product Category','Customer Segment'],
calculations: [
{
column: 'Sales',
calculation: 'sum'
}
]
};

popily.chart.getAndRender('#chart-4', insightOptions);

Notice something different about this chart? Popily's analytics engine realized that your new request needed to be visualized in a different way, and automatically made the change for you.

What if we only care about two product categories: technology and furniture? Just add that to your request to Popily and the intelligent analytics engine does the rest:

var insightOptions = {
source: 'sales-data',
columns: ['Sales', 'Product Category','Customer Segment'],
calculations: [
{
column: 'Sales',
calculation: 'sum'
}],
transformations: [{
column: 'Product Category',
op: 'eq' // "equals"
values: ['Technology', 'Furniture']
}]
};

popily.chart.getAndRender('#chart-4', insightOptions);

Now you can see the real difference between Popily and other analytical products. Popily is not a tool for building charts, Popily is an intelligent analytics engine for automated customer-facing analytics generation. You tell Popily the relationship you want and Popily does the rest.