Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive, Interpret and Display QueryResults as Swift Charts #84

Open
16 tasks
winsmith opened this issue Feb 8, 2022 · 1 comment
Open
16 tasks

Receive, Interpret and Display QueryResults as Swift Charts #84

winsmith opened this issue Feb 8, 2022 · 1 comment

Comments

@winsmith
Copy link
Contributor

winsmith commented Feb 8, 2022

With the recent changes in the server, and the move to using CustomQuery as much as possible comes also a new infrastructure for calculating queries on the server. This infrastructure will always result a QueryResult object in response to a query that will be sent to it.

Right now we cannot interpret QueryResult objects in the app, but it should be our goal to moving towards displaying these properly. This can lead to a partial refactoring or redesign of how charts and insights are displayed – let your heart be your guide.

A QueryResult object has 3 sub-objects. All of these might be special cases in most ways of displaying them.

  • TimeSeriesQueryResult
  • TopNQueryResult
  • GroupByQueryResult

The following is an overview over the possible display types we should be able to display.

Debug Display: Show Raw JSON

  • Debug: Create a way to just show the raw QueryResult as JSON text

This will help us figure out the infrastructure of how the new QueryResult works, especially together with task-based queries. It will also help us get up and running and rule out other errors. If something doesn't work, we can check the raw JSON view.

Table Display 🔢

The current raw display type tries to be pretty smart in figuring out what information to display: It can become a table, a single number, or a single number that auto-compares to the previous number. However, even as the table, it can always only display Integers right now, and only one or two columns. It needs to be replaced by a version that is even more flexible.

We should make this more explicit, so we're splitting it up into a 'single number" display, and a 'table' display. The table should always try to represent the data as accurately as is possible in a two-dimensional table. This means numbers should don't be abbreviated into e.g. "12K" instead of "12,293", and all lines and columns of the column should be accessible, even if this leads to scrolling.

  • Show a TimeSeriesQueryResult as a table
  • Show TopNQueryResult as a table
  • Show a GroupByQueryResult as a table

#️⃣ Single Number Display

The single number should always display the first row of the query result only. If there is more than one row, it should show the second row smaller, and compare the first row to the second row if possible. If there are more than two rows, all subsequent rows are ignored.

The single number display should very much look like a widget, with fonts, sizes and margins inspired by e.g. the calendar widget.

  • Show a GroupByQueryResult as a single number if it only has one entry
  • Show a TopNQueryResult as a single number if it only has one entry
  • Show a TimeSeriesQueryResult as a single number if it only has one entry

📊 Bar Chart

Bar Charts work just as before, so it might be enough to create some glue code between the various QueryResult flavors and the existing implementation. The current bar chart implementation does not support stacked bars, and moving to stacked bars is not part of this ticket – it's okay to ignore part of the data if that data would result in a stacked bar chart.

  • Show a TimeSeriesQueryResult as a bar chart
  • Show TopNQueryResult as a bar chart
  • Show a GroupByQueryResult as a bar chart

Note that bar charts make mostly only sense for groupBy and time series results, but let's implement them for topN results anyways. It's not a lot of additional work, and it might be helpful to see, e.g. a representation of how the values are distributed in a topN result.

📈 Line Chart

Same situation as with bar charts: multiple lines are not part of this ticket, just ignore additional data sets. Also, they should be implemented for all current results types.

  • Show a TimeSeriesQueryResult as a line chart
  • Show TopNQueryResult as a line chart
  • Show a GroupByQueryResult as a line chart

🍩 Donut Chart

Donut Charts could in theory display multiple data sets by having multiple rings, but we're going to ignore that for now. So same idea: Just pick the first dataset and update the donut charts in a way that can display it.

  • Show a TimeSeriesQueryResult as a donut chart
  • Show TopNQueryResult as a donut chart
  • Show a GroupByQueryResult as a donut chart
@winsmith winsmith mentioned this issue Feb 16, 2022
6 tasks
@winsmith winsmith changed the title Receive, Interpret and Display QueryResults Receive, Interpret and Display QueryResults as Swift Charts Jun 8, 2022
@winsmith
Copy link
Contributor Author

winsmith commented Jun 8, 2022

Update: This ticket is now a Swift Charts ticket. Everything in here relates to Swift Charts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant