vb.net - ZedGraph - Force all graph panes to be the same size -
i using zedgraph command (zgc) create individual stacked bar charts , display them in single stacked column shown in image below.
the issue having have no command on number of panes displayed in command determined number of items in listbox. seems default nature of command allows height of graph panes alter depending on number of panes displayed within control.
the zgc set dock=fill within panel command set dock=fill within form. forcefulness graph panes static height , when needed have vertical scroll bar appear in panel when number of graph panes exceeds height of form. how can go achieving this? code creating , populating zgc posted below image.
private sub creategraph(byval dat date) dim count integer = 0 dim master masterpane = zgc.masterpane master.fill = new fill(color.fromargb(180, 180, 180), color.fromargb(180, 180, 180), 45.0f) master.panelist.clear() master.title.isvisible = true master.title.text = "workload " & dat.toshortdatestring() master.margin.all = 10 master.innerpanegap = 5 master.iscommonscalefactor = false each mach string in lbmach.items rowcount = 0 dim mypanet new graphpane(new rectangle(10, 10, 10, 10), "", "time in minutes", mach) mypanet.fill.isvisible = false mypanet.chart.fill = new fill(color.white, color.white, 45.0f) mypanet.basedimension = 3.0f mypanet.xaxis.title.isvisible = false mypanet.xaxis.scale.isvisible = false mypanet.xaxis.scale.min = 0 mypanet.xaxis.scale.max = (meisettings.wrkhrs * 60) mypanet.legend.isvisible = true mypanet.border.isvisible = false mypanet.title.isvisible = false mypanet.xaxis.majortic.isoutside = false mypanet.xaxis.minortic.isoutside = false mypanet.xaxis.majorgrid.isvisible = true mypanet.xaxis.minorgrid.isvisible = true mypanet.margin.all = 1 if count = lbmach.items.count - 1 mypanet.xaxis.title.isvisible = true mypanet.xaxis.scale.isvisible = true mypanet.margin.bottom = 10 end if if count > 0 mypanet.yaxis.scale.isskiplastlabel = true end if mypanet.yaxis.minspace = 20 mypanet.y2axis.minspace = 20 dim dt datatable = itemsbymachinedt(mach, dat) dim mycurve baritem if dt.rows.count > 0 dim profname string = nil dim timedur() double each dr datarow in dt.rows if profname = dr("pro").tostring() timedur = {((convert.todouble(dr("qty")) / convert.todouble(dr("mpm"))))} else timedur = {((convert.todouble(dr("qty")) / convert.todouble(dr("mpm")) + convert.todouble(dr("time"))))} end if mycurve = mypanet.addbar(dr("job").tostring & " - " & dr("pro").tostring(), timedur, nothing, barcolor(rowcount)) if meisettings.isgradient = true mycurve.bar.fill = new fill(barcolor(rowcount), color.white, barcolor(rowcount), 90.0f) else mycurve.bar.fill = new fill(barcolor(rowcount), barcolor(rowcount), barcolor(rowcount), 90.0f) end if rowcount += 1 profname = dr("pro").tostring() next end if mypanet.yaxis.majortic.isbetweenlabels = true mypanet.yaxis.type = axistype.text mypanet.barsettings.type = bartype.stack mypanet.barsettings.base = barbase.y master.add(mypanet) count += 1 next zgc.isshowpointvalues = true using g graphics = me.creategraphics() master.setlayout(g, panelayout.singlecolumn) master.axischange(g) end using end sub
to command each graphpane :
graphpane temp = zgc.masterpane.panelist.elementat(ind); //ind => index of graphpane in zedgraphcontrol
to set static height n width zedgraphcontrol :
zgc.size = new size(width,height);
to set visibility of scrollbar zedgraphcontrol :
zgc.isshowhscrollbar = true; zgc.isshowvscrollbar = true;
vb.net winforms zedgraph
No comments:
Post a Comment