Git Product home page Git Product logo

Comments (8)

jjmontesl avatar jjmontesl commented on September 22, 2024

In order to tell on which side it is, can you please turn on the browser inspect tools and check the network tab? Please post, for both queries, the request performed by CubesViewer and a sample of the response JSON from Cubes.

from cubesviewer.

62mkv avatar 62mkv commented on September 22, 2024

Ok, so, bar chart:

request:
http://localhost:5000/cube/spending_amounts/aggregate?drilldown=spending_date@weekly:month|item@default:category&cut=currency@default:EUR

response (first several items, 22kb total):
{ "summary": { "amount_sum": 2558.0700000000006, "record_count": 1063 }, "remainder": {}, "cells": [ { "spending_date.year": 2018, "spending_date.month": 4, "item.category": "\u041f\u0440\u043e\u0435\u0437\u0434", "amount_sum": 220.6, "record_count": 1 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043d\u0430 \u0447\u0442\u043e", "amount_sum": -12.0, "record_count": 2 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0438", "amount_sum": -1600.0, "record_count": 6 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041e\u0434\u0435\u0436\u0434\u0430, \u043e\u0431\u0443\u0432\u044c", "amount_sum": -22.7, "record_count": 3 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041e\u0442\u0434\u044b\u0445", "amount_sum": -68.21, "record_count": 12 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041f\u0438\u0442\u0430\u043d\u0438\u0435", "amount_sum": -219.7, "record_count": 36 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041f\u0440\u043e\u0432\u043e\u0434\u043a\u0430", "amount_sum": 2385.0, "record_count": 1 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u041f\u0440\u043e\u0435\u0437\u0434", "amount_sum": -25.0, "record_count": 1 }, { "spending_date.year": 2018, "spending_date.month": 5, "item.category": "\u0425\u043e\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u044b", "amount_sum": -192.95, "record_count": 11 },

same but for Pie chart after "remove horizontal dimension":
Request:
http://localhost:5000/cube/spending_amounts/aggregate?drilldown=item@default:category&cut=currency@default:EUR

Response (complete response, 3 kb total):
{ "summary": { "amount_sum": 2558.0700000000006, "record_count": 1063 }, "remainder": {}, "cells": [ { "item.category": "\u0417\u0434\u043e\u0440\u043e\u0432\u044c\u0435", "amount_sum": -379.38, "record_count": 18 }, { "item.category": "\u041a\u043e\u0441\u043c\u0435\u0442\u0438\u043a\u0430", "amount_sum": -27.34, "record_count": 3 }, { "item.category": "\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043d\u0430 \u0447\u0442\u043e", "amount_sum": -212.15, "record_count": 15 }, { "item.category": "\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435", "amount_sum": -3786.19, "record_count": 16 }, { "item.category": "\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u0438", "amount_sum": -6378.950000000001, "record_count": 55 }, { "item.category": "\u041e\u0434\u0435\u0436\u0434\u0430, \u043e\u0431\u0443\u0432\u044c", "amount_sum": -561.4700000000001, "record_count": 51 }, { "item.category": "\u041e\u0442\u0434\u044b\u0445", "amount_sum": -2875.150000000001, "record_count": 278 }, { "item.category": "\u041f\u0438\u0442\u0430\u043d\u0438\u0435", "amount_sum": -3991.5499999999965, "record_count": 424 }, { "item.category": "\u041f\u0440\u0438\u0445\u043e\u0434", "amount_sum": 22890.0, "record_count": 10 }, { "item.category": "\u041f\u0440\u043e\u0432\u043e\u0434\u043a\u0430", "amount_sum": 1235.0, "record_count": 6 }, { "item.category": "\u041f\u0440\u043e\u0435\u0437\u0434", "amount_sum": -1854.93, "record_count": 76 }, { "item.category": "\u0425\u043e\u0437\u0440\u0430\u0441\u0445\u043e\u0434\u044b", "amount_sum": -1499.8200000000002, "record_count": 111 } ], "total_cell_count": 12, "aggregates": [ "amount_sum", "record_count" ], "cell": [ { "type": "point", "dimension": "currency", "hierarchy": "default", "level_depth": 1, "invert": false, "hidden": false, "path": [ "EUR" ] } ], "levels": { "item": [ "category" ] }, "attributes": [ "item.category" ], "has_split": false }

from cubesviewer.

62mkv avatar 62mkv commented on September 22, 2024

cubesviewer_piechart
And here's how it looks like afterwards:

from cubesviewer.

jjmontesl avatar jjmontesl commented on September 22, 2024

I've been looking at this but I'm not able to reproduce it.

But seems the response does contain 12 values, so looks like a bug in CubesViewer.

  1. Can you check if this might be due to Unicode characters? can you try changing the labels?
  2. How many rows does the "series view" present? (it should present 12 rows also).
  3. How many columns are presented using "vertical bars chart"? (it should be 12 too).
  4. Does this happen if you remove the currency filter?
  5. Does this happen if drilling down by other dimensions?
  6. Does the Javascript console in the browser present any error or warning?

If we cannot pinpoint the root cause, ultimately, I might need a reproduction data (if you can reproduce the issue with a minimal dataset and model).

from cubesviewer.

jjmontesl avatar jjmontesl commented on September 22, 2024

It may also be of help if you could run a quick test with the latest jjmontes/mapchart branch (just checkout that branch and load studio.html in the html folder).

from cubesviewer.

62mkv avatar 62mkv commented on September 22, 2024

damn, I think I've got the reason :( so, this is a cube of a household budget. One category holds incomes; the others are spendings. So, only one (or in the case of that slightly non-normalized data I've had, two) contains positive values; the rest of them contain negative ones.

Sorry for distraction (. Also, to be honest, I would prefer to be able to have a pie chart for negative values as well. Can you suggest anything ? I guess I could put "-amount" as an expression in this model.json section somehow ?
"aggregates": [ { "name": "amount_sum", "function": "sum", "measure": "amount" }, { "name": "record_count", "function": "count" } ],

from cubesviewer.

jjmontesl avatar jjmontesl commented on September 22, 2024

Regarding using -amount, and assuming you are mapping your transactional database (as oppossed to using a ETL process to customize your OLAP database): you could create a database view with your calculated columns and use it instead (my preference), or, depending on your cubes version you may be able to use an attribute mapping such as:

mappings {
    ...,
    "amount": {"table": "yourtable", "column": "amount", "function": "-"}
}

I have just tested this on the latest cubes (master) and seems to work correctly, but I seem to recall there might be an issue with functions. My preference is to either use database views or to create an ETL process and create an analytic database, but your mileage may vary.

from cubesviewer.

jjmontesl avatar jjmontesl commented on September 22, 2024

Regarding the negative values in the pie chart, I can confirm negative values are not shown by the pie chart, which imho is not reasonable. Thanks a lot.

So, the very minimum would be to inform the user that N slices are missing due to negative values (possibly shown as 0 value to force their inclusion in the legend?), and show it correctly if all of them are negative.

Would this work for you, or do you have something else in mind for positive+negative values in a pie chart?

I'm closing this issue as resolved and opening #101 to tackle this particular issue. Please post your comments there.

from cubesviewer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.