Teechart + Multiple Box Plots - activex

I need to plot around 80 Box Plot in Single chart, I have created 80Series with 7 Point eachs, The Issue is the Box plot are plotted properly since I am using Position but the problem is on X axis I am getting only 7 points labels I want that for all the 80 Box Plot.

I have made a simple code that I think you can use to achieve as you want:
Private Sub Form_Load()
TChart1.Aspect.View3D = False
TChart1.Legend.Visible = False
Dim i As Integer
For i = 0 To 80
TChart1.AddSeries scBox
TChart1.Series(i).FillSampleValues 7
TChart1.Series(i).asBoxPlot.Position = i + 10
Next
TChart1.Axis.Bottom.Labels.Style = talValue
TChart1.Axis.Bottom.Labels.Angle = 90
End Sub
Could you tell us if previous code help you? If it doesn't help please, tell us exactly what you want, so, we will try to give you, a good solution.
Thanks,

Related

Gnuplot filled curves adds unwanted "bottom" border

I am trying to visualize a time series data set on one plot as a pseudo 3d figure. However, I am having some trouble getting the filledcurves capability working properly. It seems to be adding an unwanted border at the "bottom" of my functions and I do not know how to fix this.
This is my current set up: I have nb_of_frames different files that I want to plot on one figure. Without the filledcurves option, I can do something like this
plot for [i=1:nb_of_frames] filename(i) u ($1):(50.0 * $2 + (11.0 - (i-1)*time_step)) w l linewidth 1.2 lt rgb "black" notitle
which produces a figure like this:
no fill options
Instead of doing this, I want to use the filledcurves option to bring my plots "forward" and highlight the function that is more "forward" which I try to do with:
plot for [i=1:nb_of_frames] filename(i) u ($1):(50. * $2 + (11. - (i-1)*time_step)) w filledcurves fc "white" fs solid 1.0 border lc "black" notitle
This produces a figure as follows:
This is very close to what I want, but it seems that the border option adds a line underneath the function which I do not want. I have tried several variants of with filledcurves y1=0.0 with different values of y1, but nothing seems to work.
Any help would be appreciated. Thank you for your time.
Here is another workaround for gnuplot 5.2.
Apparently, gnuplot closes the filled area from the last point back to the first point. Hence, if you specifiy border, then this line will also have a border which is undesired here (at least until gnuplot 5.4rc2 as #Ethan says).
A straightforward solution would be to plot the data with filledcurves without border and then again with lines. However, since this is a series of shifted data, this has to be plotted alternately. Unfortunately, gnuplot cannot switch plotting styles within a for loop (at least I don't know how). As a workaround for this, you have to build your plot command in a previous loop and use it with a macro # (check help macros) in the plot command. I hope you can adapt the example below to your needs.
Code:
### filledcurves without bottom border
reset session
set colorsequence classic
$Data <<EOD
1 0
2 1
3 2
4 1
5 4
6 5
7 2
8 1
9 0
EOD
myData(i) = sprintf('$Data u ($1-0.1*%d):($2+%d/5.)',i,i)
myFill = ' w filledcurves fc "0xffdddd" fs solid 1 notitle'
myLine = ' w l lc rgb "black" notitle'
myPlotCmd = ''
do for [i=11:1:-1] {
myPlotCmd = myPlotCmd.myData(i).myFill.", ".myData(i).myLine.", "
}
plot #myPlotCmd
### end of code
Result:
I can reproduce this in gnuplot 5.2.8 but not in the output from the release candidate for version 5.4. So I think that some bug-fix or change was applied during the past year or so. I realize that doesn't help while you are using verion 5.2, but if you can download and build from source for the 5.4 release candidate that would take care of it.
Update
I thought of a work-around, although it may be too complicated to be worth it.
You can treat this as a 2D projection of a 3D fence plot constructed using plot style with zerrorfill. In this projection the y coordinate is the visual depth. X is X. Three quantities are needed on z: the bounding line, the bottom, and the top. I.e. 5 fields in the using clause: x depth zline zbase ztop.
unset key
set view 90, 180
set xyplane at 0
unset ytics
set title "3D projection into the xz plane\nplot with zerrorfill" offset 0,-2
set xlabel "X axis" offset 0,-1
set zlabel "Z"
splot for [i=1:25] 'foo.dat' using ($1+i):(i/100.):($2-i):(-i):($2-i) \
with zerrorfill fc "light-cyan" lc "black" lw 2

Facet Grid with Time Series

I am trying to create a time series graph by year using facet_grid so that the data is plotted above each other. However, when I plot it, there is a lot of blank space due to how the data is broken out (ie the 2017 graph still shows the time series for 2018 and 2019 but with no data, I would like to remove this blank space). How can I free the scale of the x coordinates so it does not show all years?
My Code
proportion_data %>%
ggplot(aes(x = new_date, group = 1)) +
geom_line(aes(y = prop_elect, color ="elect_prop")) +
geom_line(aes(y = prop_water, color ="water_prop")) +
geom_line(aes(y = prop_natgas, color ="natgas_prop")) +
facet_grid(Year ~., scales = "free" )
Utilities by Year
My Data
enter image description here
Any advice would be much appreciated!
Thanks,
Kris
Have you tried using the space option?
facet_grid(Year ~., scales = "free" ,space="free_x")
Another option is to use facet_wrap instead of facet_grid
facet_wrap(~Year, scales = "free" )

Increase gap between two point labels in line chart

I have integrated a line chart in my project using Charts library and have been using it for a while now. It was working fine with few data points, however as the number of data have been increased since then the point labels (x-axis) are overlapping with each other. Is there a way to display the data-point labels without getting overlapped?
you can solve this issue using labelCount property. also, you can set using setLabelCount property, I hope this helps you.
xAxis.labelCount = 5
xAxis.setLabelCount(5, force: true)
See this post for more info: https://github.com/danielgindi/Charts/issues/1969
I was not able to find how to increase the gap between two labels on x-axis (top) however I have managed to improve the issue a little by displaying them vertically so that they are at-least visible on chart.
lineChartView.xAxis.labelRotationAngle = 270

How to shift data on xAxis to right on Daniel Gindi charts?

I have a data chart DataChart would like to shift data of xAxis along with data lines to right by certain value.
DataChart Screen Shot
Please help me out which property to use from the library that would be able to solve this purpose.
I am using Daniel Gindi line charts for this purpose.
I use this to create an offset to the left of my chart
myChart.xAxis.spaceMin = 10
maybe it'll do for you
And to align the yAxis lines in front of the labels, i think you could remove the background grid and create your own limit lines if you don't find any other way around
is it viable to subtract the distance d from the x values? that would shift it rightward.
d = 7.0
rightShifted = newGraphData.values.map{ChartDataEntry(x:$0.x-d, y:$0.y)}

Teechart Extra Legend Tool

I Want to Show Mean, Median and Standard Deviation in chart area in case of Box Plot.Since Custom Legend tool is not avaiable taught of using Extra Legend tool.
The problem is that I am not able to Position the extra legend in blank space after my bottom Axis.Can anyone help me in this.
I think your problem is produced because you need repaint the Chart, before try to calculate the custom position the ExtraLegend Tool. You can do something similar as I do in next simple code, where I have drawn a ExtraLegend Tool align to original Legend:
Private Sub Form_Load()
TChart1.AddSeries scBox
TChart1.AddSeries scBox
TChart1.Series(0).FillSampleValues 5
TChart1.Series(1).FillSampleValues 5
TChart1.Legend.LegendStyle = lsValues
TChart1.Series(0).asBoxPlot.Box.Brush.Color = vbRed
TChart1.Series(1).asBoxPlot.Box.Brush.Color = vbBlue
TChart1.Tools.Add tcExtraLegend
TChart1.Tools.Items(0).asExtraLegend.Series = TChart1.Series(1)
'Use internal Repaint to calculate the position of Legend.
TChart1.Environment.InternalRepaint
With TChart1.Tools.Items(0).asExtraLegend.Legend
.CustomPosition = True
.Left = TChart1.Legend.Left
.Top = TChart1.Legend.ShapeBounds.Bottom + 10
End With
End Sub
Could you tell us if my suggestion code help you to solve your problem?
I hope will helps.
Thanks,

Resources