Flutter : custom gauge segmented bar - flutter

I have a variable value from 1 to 5000
And would like to create a custom bar chart that represents each tick as 200, so that I have 5 segments of 5 bars x 5 segments.
What's the best way to create this in flutter (like in the image)?
The closest that I found in the documentation is the demo of battery in sync fusion library. But I think my understanding of the library is limited. It uses multiple linear range, with calculation that I can't seems to wrap my head around it.
Is it also possible to use flutter stack to "mask" a normal default bar for the segments and mini bars?

Related

How to achieve this kind of heatmap / bar chart with Chart.js

I have to build a horizontal bar with chartjs. I already built a few of them but its a bit different. The chart has 2 labels for the yAxis ("Storm Risk", "Ice Risk") and hours for the xAxes. I have to print out for every hour one of these different options with different colors ("Low", "Medium", "Hight") as ye can see in the screenshot attached.
This kind of bar chart usually the values are represented by the length of the bar and its a bit different.
Any suggestion?.
Thanks
The chart you want to implement is a sort of a "heatmap". As of now (Sep. 2018), Heatmap charts are not supported out of the box by Chart.js. However, you can make one out of a stacked bar chart (in this case, probably stacked horizontal bar chart?): make each stack size equal to one another and each item backgroundColor depending on the actual values being represented. Once this is done, you can override ticks and tooltips using with according callbacks. Legend can be implemented by one more bar chart with sample values and colors.
More details can be found in a related GitHub issue: https://github.com/chartjs/Chart.js/issues/4627
Another alternative would be to use a BubbleChart. The strategy would be similar - you would need to make all bubbles same size, but override their colors. However, provided the look in the question, stacked horizontal bar chart will be more suitable.
Another option for those who are still looking is to use chartjs-chart-matrix https://chartjs-chart-matrix.pages.dev/usage.html plugin.
Example of implementation with Chart.js v3: https://www.youtube.com/watch?v=bi04BgvNY6U

pie chart but in another shape

I just wanna ask if it is possible to make a pie chart but in another shape.
An example would be say there were two candidates who ran for governor in a state. I would want to show the results in a chart. I want the shape of the chart to resemble the shape of the geographical location of the state.
I did some digging and this is the only one that showed up which may help me(but not really) https://forums.adobe.com/thread/988130
As your adobe thread implies there are (at least) three issues to consider:
1) you want to show the votes each candidate received as a portion of the area of the state. If your state is nearly square, you could overlay a grid and assign each candidate a number of grid cells according to the votes they received. If the grid cells are county or precinct outlines that works even better, but this isn't a pie chart because a pie chart uses a polar coordinate system.
2) if you really must have a pie chart which is polar, consider that the average viewer may not be able to visually integrate the areas to get meaningful results. Further you will have to integrate the area swept out by the sectors of the pie like a radar screen, and this contour integration is made more difficult by the fact that you must do it numerically. This means you must sample the boundary distance as a function of angular displacement from some center of gravity you have chosen, like the state capitol. But depending on the location of the state capitol, your visual could become even more distorted. Idaho comes to mind.
3) a good compromise might be just to overlay a pie chart on top of a silhouette or map outline of the state with appropriate drop shadows and emphasis to make the pie chart pop as well as the state outline. it would certainly be much quicker as well as much more readable.

Conversion of a stacked bar chart to a 100% proportional stacked bar chart

I am currently working on a dashboard to analyze the job market in Singapore. I made a stacked bar chart for job functions vs career level. My supervisor asked me to create a proportional stacked bar chart to see the clear difference in ratios of the career levels.
The dimensions I used was Job Function (jobs of specific industry such as accounting, admin etc) and Career level (jobs of career level such as entry middle and senior) and
The expressions I used was Count(Job Function). The issue is I can't make a proportional chart as the count of jobs varies for each career level for every job function.
Without seeing a sample of the data and exactly how you are displaying it I cannot give you an example.
From what I understand you want the min and max values in the chart (on y axis) to not change based on your selections?
You would have to create a variable and get the max value for said chart, and use set analysis to ignore selections. You would then use this variable in your Properties->Axes->Scale on the object/chart.

Interactive bar chart.user changes y axis value at runtime by dragging it

For example 3 columns are there with y axis value as 100,200,300 in barcharts.
User select one column alone and drag it to 500 value in y-axis.
How to achieve this?
Is it available in library like androidplot or aChartPlugin?
If not which plugin support this requirement.Our project is for Android tablets
Please provide me sample code for this requirement.Thanks in advance.
To my knowledge no library exists for Android that provides 'out of the box' capabilities to drag and reorganize data. Having said that, any library that provides you with a way to correlate touch events to data elements and also supports dynamic updates should be suitable.
If you have specific requirements about how the "drag" is implemented then you may end up having to roll your own library or customize an existing one to your needs. If not, here's a basic workflow you could implement with Androidplot that represents the drag operation as a cursor:
1 - Detect selections using an OnTouchListener. Here's an example of a bar plot that allows bar selection via touch. Gives a full example of converting screen coords to model elements etc. Create and add an instance of XValueMarker denoting the current position of the selection. (An XValueMarker is basically a customizable vertical line marking an x-val.
2 - Detect "drag" events using an OnTouchListener. Here's an example that detects zooming and scrolling. It's not the same thing exactly but the scrolling logic is close enough to give you the general idea.
3 - As the user drags, update the position of the XValueMarker by XValueMarker.setValue(Number).
4 - Once the "drag" ends, remove the XValueMarker and modify the underlying XYSeries to reflect the change using basic data structure manipulation(s).
And of course remember to always call plot.redraw() after each operation that is expected to alter the appearance of the plot in some way.

google chart problem

I am using google gwt visualizations chart in gwt application.
I want to show only 2d chart.
but the following problems come.
.
In colums chart
it show scale like 0.0 , 10.4 ,40.5 ....
how to customize the Change scale of the graph. scale should uniform . for example if highest number is more than 400 then it should be 0 , 100, 200 ,300 and if it is 90 then it should be 0 ,20,40,60,80
in piechart
it shows percentage on the slice want to show the actual value.
Thanks In advance
Concerning the column chart, I've never seen that behavior. Maybe it comes from the way you build your data ?
In contrast, about your piechart's question, if you have the last version of gwt visualization (1.1.1), in the PieChart.PieOptions class, there is a method named setPieSliceText(String text).
This method takes 4 possible parameters :
percentage : to display the percentage value
value : to display the quantitive value of the slice
label : to display the name of the slice
none : I think it's obvious ;)
If you don't have the last version and if you can't make the upgrade, just extend the static class PieOptions and implement the native method by yourself.
I hope it helps!