How to initialize iOS Charts to show data points at a specific x-axis range, e.g. last 6 months from today? - swift5

I have a question about iOS Charts by Daniel Cohen Gindi here. The figure below shows my full dataset drawn out as a scatter chart. With the x-axis labels going from January to December (let's say 2018), and then again January to December (2019).
The problem is that I don't want to show all data in range, but just in the past six-month range, July-December, as I want the scatter chart view to look like depicted below. (Note: assume the right-most data point is today.)
I want the user to be able to scroll right to see more data points in the past. I've tried this Swift code below but it would "lock" the x-axis to show July-December, and the user can't scroll right to see past data:
#IBOutlet weak var scatterChartView: ScatterChartView!
scatterChartView.xAxis.axisMinimum = 17.5 // + or - 0.5 for padding
scatterChartView.xAxis.axisMaximum = Double(months.count) - 0.5
And then I would try this code below but it would initially show data from the first 6 months, January-June of 2018. However, the user could scroll left to see the later months.
scatterChartView.setVisibleXRangeMaximum(6)
Close but not quite. Is there any way I could show data from the last 6 months upon loading the scatter chart, and have the user scroll right to see past data?

I found the answer!
scatterChartView.moveViewToX(17.5)
Per documentation, moveViewToX(float xValue) – Moves the left side (edge) of the current viewport to the specified x-value. The view port refers to "what is visible on the chart, aim of the view).
Upon chart loading, the viewport is initialized showing the most recent 6 months, and I can scroll right to see past data.

Related

Time Stack Chart with years as horizontal axis

I want to add a stacked chart but could not find a way to customize the time-axis.
Currently my x-axis refers to days, however, I search for a way to display years. Since I want a stacked chart that changes over time, I believe I need to use the 'Time Stack Chart' (see screenshot). I would also be happy with simply several stacked bars next to each other (each bar represents one year), but the 'Bar Chart' only supports one bar (I believe).
My model collects data from different sources on the last day of the year and then my chart should display this value for the year, categorized by source. I have tried with different data sets, both where the time is the horizontal value and where it is not.
When I use a dataset where one value is 'Years' (through the getYear() function) this works fine for plots, but not when I want to have a stacked chart (which by default depends on the time).
Is there a solution to this?
Please let me know if you need further information!
You need to go to the appearance part, time axis format, set it to yyyy. Also in the scale section, you need to change model time units to years.

Back syncfusion chart drawing when scrolling

Good day. Faced the problem with the back drawing of the graph using syncfusion_flutter_charts (if necessary). If I need to build the values ​​in front, then there is no problem:
chartSeriesController?.updateDataSource(addedIndexes: [...]);
But how to do it behind? The point is that my data is a date:value pair (x: date, y: value). And I display only the latest data, for example 7 days, 30 days. But if the user wants to see the previous results, then he need to scroll to the left and be able to see the previous days and their values ​​with the same detail (7, 30 days). As far as I understand, I'm satisfied with two solutions, displaying all the data at once, but from a certain index and the number of days at a time with the ability to scroll left and right, and gradual rendering, for instance the user will move with +1 & -1 value. It is also important that the detailing of the chart is chosen not by movements on the chart, but in the menu (I have it implemented). Thanks for your suggestions.

Qlikview Combo Chart - Series not aligning with Axis

I have a combo chart that I want to track Actual spending versus Budget over a 3 year period. The Budget line items are bar charts, the Actuals are displayed by a symbol. There is only one data point for Actuals, 2020, Budget data is for 2020-2022. My problem is that Actuals are aligning with 2021, not 2020. Viewing the data as a straight table, I know my data calculations are correct. I am not suppressing zeros and the order of expressions (promote, demote) has no effect. Any ideas why this is happening and how to fix it?
Image explaining the issue

Custom number format for y-axis on Chart

I have created a chart with 2 axes that acts as a panel chart (see image)
As a panel chart I only want to show the portions of the relevant y-axes to the chart next to them. For example, for the right-most y-axis I used a custom number format to exclude anything less than 0:
_(* #,##0_);_("";_(* 0??_);_(#_)
But for the left most y-axis, I'm stuck. I want to show -400 to positive 400. I've tried 2 different options, but neither is producing the desired effect.
[<0](#,##0);[>500000000]"";#,##0_)
[<0](#,##0);[<500000000]#,##0_);""
Here is the result I'm looking for:
I learned something new today (and a bit weird) regarding formats and chart axes
After some experimenting, this is what I ended up using:
[White][>500]_(#,##0_);(#,##0);0;
The odd part: When you change the Display Units of the axis (for me, millions), then the formatting no longer recognizes the original amount (500,000,000).
Once I figured that out, I was able to work out the solution.

Tableau Public, Box Plots: combine 4 rows into 1 with 4 plots per month

I have a Tableau Public sheet with 4 years of data.
Each day has a value, and I am showing those daily values as a box plot - one for each month of each year.
Currently it is set up as 4 rows (1 for each year), and 12 columns.
See here:
https://public.tableausoftware.com/views/boxplotsbyyearmonth-dailyvalues/Sheet1?:embed=y&:display_count=no
What I want to do is drop to a single row, and show all 4 box plots side by side within each month, colored by year.
I can't elaborate what exactly I have tried, as I am new to Tableau, and have done a lot of clicking around looking for options, and have tried searching various sites and Google, to no avail.
Is there a simple trick to this, or is it something complex I have to do to?
UPDATE:
I have figured out how to get them lined up correctly, by dragging the year dimension to the columns section, which I had tried, but then I had to reset the other dimensions, and it took.
What I still can't figure out is the coloring.
By dragging the year to the color property, it colors the outliers, which are separate marks, but the box plots are not affected.
When you pull the year field to color it will color the marks (all of them, including the outliers). If you want to change the color of the box plot container you need to select it and right click.
I made some edits, let me know if this is what you were trying to accomplish:
https://public.tableausoftware.com/views/boxplots_0/Sheet1?:embed=y&:display_count=no