Candle chart view in MPChart library zoom issue on android application - mpandroidchart

I have a requirement to plot the candle chart with 100 years worth of data, for the years 1920 to 2020. When I plot the graph using mp chart, it shows all 100 years of data on graph.
My requirement is to show the last 20 years of data (form 2001 to 2020) when rhw app launched. In addition, users should be able to scroll the graph from right to left to see remaining years of data on the graph.
I've used this code:
mChart.setVisibleXRange((mChart.getXChartMax()-mChart.getXChartMin())/3);
However, this divides the graph view in 3 parts and shows data from 1920 to 1956.
Please help me out with this problem.
Thanks in advance.

You need to specify the range after you setData(), invalidate() or notifyDataChangeSet()
mChart.setVisibleXRangeMaximum(20);
If you want to scroll the X to right you can use this:
mChart.moveViewToX(Integer.MAX_VALUE);

Related

how to align chart + html.table in a Plotly Dash app?

I'm trying to reproduce a layout where the table and the chart should be aligned as in the image below:
The main idea is to work for 1 to N values, always aligned to each other.
I tried to create a "fake" graph inside the table but as you can see in the image below it doesn't work exactly as expected
So I would like to know what's the best way to:
1- calculate and set the size needed for each bar in the graph
2 - set it dynamically based on how many entries the data has
3 - Don't forget please, ALWAYS ALIGNED
IF needed I can share the code of the table or of the layout graph + table I'm using;
Thank you in advance.
Regards,

Is there any built in function in pandas to subtract various columns to manipulate a stacked bar chart?

I hope I do not brake too much rules (this is my first post).
First Things first: I'm sorry, but I cannot post an image of my plots or Code right now. So I created a pretty image in paint. On the left side you see what I want to create, on the right side you see what I create right now.
Example
I was able to make a barchart as shown on the left side with lots of detours. Since I have to analyse lots of data in similar charts I want to use the built in plot function of Pandas.
What I need: stacked bar chart, where the values are not summed up (like shown in the right image) but the difference of the values are summed up (like shown in the left image). So if s1 = 2 and s2 = 6 and i just do some stuff like groupby().unstack().plot(kind='bar', stacked=True) I got stacked bars which end at y=2 for s1 and y=8 for s2 (like shown in the right diagram).
How can I modify my code so that I will get y=2 for s1 and y=6 for s2?.
I thought about diff(), but the result was definetly not like expected.
I hope my question is clear.
Thanks for your adviced and best regards
Arnfried

Overlapping bar chart with multiple axis in PowerBi

I would like to have a overlapping bar chart in PowerBi with multiple axis. I have an example from Excel which I would prefer to recreate in PowerBi if this is possible.
Here the example:
Is this possible in PowerBi? Maybe by using a custom visual I don't know off.
Thanks in advance,
Multiple axes? Yes! Overlapping bars? No!
Using a Line and Clustered Column Chart is the way to go:
Here's a demo using some random numbers:
Date A B C
07.08.2018 0,359008828 0,993689927 0,8
08.08.2018 0,127630228 0,449164386 0,8
09.08.2018 0,431825126 0,615830289 0,8
10.08.2018 0,269830973 0,984995499 0,8
11.08.2018 0,27416548 0,64248379 0,8
12.08.2018 0,777712123 0,740108131 0,8
13.08.2018 0,264229043 0,242084953 0,8
14.08.2018 0,49124239 0,144428206 0,8
15.08.2018 0,242050334 0,020032871 0,8
16.08.2018 0,316102617 0,644935538 0,8
Use Enter Data to get a table with these numbers under Fields:
Click Line and Clustered Column Chart under Visualizations
Drag Date to Shared Axis, and change the date hierarchy to simple date using the drop down menu next to Date.
Drag C to Line Values, and A and B to Column values:
Under Y axis, set Show Secondary to On
And that's as close as you're going to get to replicate your Excel Chart at the time being as far as I know.
It's certainly not an ideal solution, but it is possible to place charts on top of each other. This is the result of two bar charts superimposed upon each other:
Note: In order to have control over the column width, you need to change the x-axis to categorical and adjust the inner padding.
There are multiple custom visuals available on the appsource now. Search for lipstick charts. see screenshot below. one of those is here
https://appsource.microsoft.com/en-US/product/power-bi-visuals/yavdaanalyticspvtltd1628223732998.lipstickcolumnpro?tab=Overview

WPF Toolkit Chart Performance

I have a chart with multiple line series (let's say 10). Each line series is comprised of about 2,000 points. Does anyone know why it takes MINUTES for the chart to render? Is this simply how poorly this control behaves?
I've found that removing the points increases performance 10-fold. However; I want to see the data points. See below how I have removed the data points...
Style pointStyle = new Style(typeof(LineDataPoint));
pointStyle.TargetType = typeof(System.Windows.Controls.DataVisualization.Charting.DataPoint);
pointStyle.Setters.Add(new Setter(TemplateProperty, null));
pointStyle.Setters.Add(new Setter(LineDataPoint.BackgroundProperty, model.LineColor));
series.DataPointStyle = pointStyle;
The line where I set the TemplateProperty to null is what made the chart perform so quickly.
Any alternatives which still display the data points?

Android MPandroid line charts x Axis View all the labels

Hi I am using MPandroid chart library for my android app.I was able to draw the charts and mange the date and time but I wanted to show Dayly,Weekly and monthly XAxis I was able to show the Daily records. Is there any supporting method or option to show the whole x Axis data I have in the array
Ex
ArrayY(Data)
ArrayX(Dates)-Dates for the current week Starting from monday.
I have data only till Wednesday so the chart is curently showing only the xaxis up to Wednesday rest of the dates are missing and My user need to see that
Any body can help ?
You should try something like this :
myChart.setVisibleXRange(0, xVals.size() - 1);
Make sure your xVals is not empty or this may throw an error.