oxyplot bars are out of order,sequential problems - oxyplot

using Oxyplot to plot candlesticks , key codes as follow:
var date = DateTime.UtcNow;
_timeSpanAxis.Minimum = DateTimeAxis.ToDouble(date.AddSeconds(0));
_timeSpanAxis.Maximum = DateTimeAxis.ToDouble(date.AddSeconds(600));
var startime = DateTimeAxis.ToDouble(date.AddSeconds(300));
items.Add(new HighLowItem(startime, 1.58334, 0.58134, 1.18199, 1.38256));
plotview.InvalidatePlot(true);
this figure can be plotted normallly.
but when i add another item, it cause exception: bars are out of order.
codes as follow:
var date = DateTime.UtcNow;
_timeSpanAxis.Minimum = DateTimeAxis.ToDouble(date.AddSeconds(0));
_timeSpanAxis.Maximum = DateTimeAxis.ToDouble(date.AddSeconds(600));
var startime = DateTimeAxis.ToDouble(date.AddSeconds(300));
items.Add(new HighLowItem(startime, 1.58334, 0.58134, 1.18199, 1.38256));
startime = DateTimeAxis.ToDouble(date.AddSeconds(400));
items.Add(new HighLowItem(startime, 1.58334, 0.58134, 1.18199, 1.38256));
plotview.InvalidatePlot(true);
i cannot figure out what's wrong here? has anybody ever encountered with such problem?

Related

Remove space between name and percentage in pie chart legend (amcharts4)

I want to get rid of that space in the legend between the name and the percentage. In the pic, I have highlighted the space in yellow.
For example, I want the first legend item to be "Lithuania (30.5%)". That extra space between "Lithuania" and "30.5%" spoils my UI.
My code for the legend is the following:
// Add and configure Series
var pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "litres";
pieSeries.dataFields.category = "country";
pieSeries.slices.template.stroke = am4core.color("#fff");
pieSeries.slices.template.strokeWidth = 2;
pieSeries.slices.template.strokeOpacity = 1;
pieSeries.ticks.template.disabled = true;
pieSeries.labels.template.disabled = true;
// This creates initial animation
pieSeries.hiddenState.properties.opacity = 1;
pieSeries.hiddenState.properties.endAngle = -90;
pieSeries.hiddenState.properties.startAngle = -90;
pieSeries.legendSettings.labelText = '{category}';
pieSeries.legendSettings.valueText = null;
pieSeries.labels.template.text = "{category}: {value}";
pieSeries.slices.template.tooltipText = "{category}: {value}";
chart.legend = new am4charts.Legend();
chart.legend.fontSize = 5;
chart.legend.markers.template.width = 5;
chart.legend.markers.template.height = 5;
What change must I make in order to get this done?
You can move the value to the "labelText":
pieSeries.legendSettings.labelText = "{category}: {value.percent.formatNumber('#.0')}%";
And disable value labels altogether:
chart.legend.valueLabels.template.disabled = true;

display data labels column stacked epplus

I have a stacked column report and i need to show the label value inside each of the series, is this possible. here is the code i have so far. It does look like barcharts have this option, not sure if i need to convert report to that type.
chart.Title.Text = "Total Pipeline - Initiative Count by Release";
chart.Title.Font.Size = 8;
chart.SetPosition(45, 0, 3, 0);
chart.SetSize(400, 300);
chart.Legend.Add();
chart.YAxis.MajorUnit = 10;
var series1 = chart.Series.Add(Chartsheet.Cells["L23:Q23"], Chartsheet.Cells["L22:Q22"]);
series1.HeaderAddress = new ExcelAddress("'Graphs'!K23");
var series2 = chart.Series.Add(Chartsheet.Cells["L24:Q24"], Chartsheet.Cells["L22:Q22"]);
series2.HeaderAddress = new ExcelAddress("'Graphs'!K24");
chart.Legend.Position = eLegendPosition.Bottom;
chart.YAxis.LabelPosition = eTickLabelPosition.NextTo;
chart.XAxis.MajorTickMark = eAxisTickMark.Out;
chart.XAxis.MinorTickMark = eAxisTickMark.None;
chart.ShowDataLabelsOverMaximum = true;
so i just forced a format of a barchart and i have the label option
var chart = (OfficeOpenXml.Drawing.Chart.ExcelBarChart) Chartsheet.Drawings.AddChart("chart", eChartType.ColumnStacked);

Modify value at the time of binding DataGrid Compact Framwork

I have used BindingSource to bind DataGrid in my window 6.5 application. But problem is that I want to change the text of a column from Int to string while grid is binding.
If you look at below code I am binding DataGrid with Designation which value is 502 but I need to display "SE" instead, I cant take that value in my Candidate object so I need to modify DataGrid at runtime. I dont know how can I achieve this. Please help . Thanks
cand.Add(new Candidate { ID = 10, Name = "Andrew", Designation =501 ,DCode="SSE" });
cand.Add(new Candidate { ID = 11, Name = "Peter", Designation = 502 , DCode="SE"});
DataGridTableStyle myDataGridTableStyle = new DataGridTableStyle();
myDataGridTableStyle.MappingName = "Candidate";
DataGridTextBoxColumn colA = new DataGridTextBoxColumn();
colA.MappingName = "Name";
colA.HeaderText = "Field A";
colA.Width = 50;
DataGridTextBoxColumn colB = new DataGridTextBoxColumn();
colB.MappingName = "Designation";
colB.HeaderText = "Position Holding";
colB.Width = 100;
//dataGrid1.CurrentCell.ColumnNumber.
DataGridTextBoxColumn colC = new DataGridTextBoxColumn();
colC.MappingName = "DCode";
colC.HeaderText = "Code Position";
colC.Width = 50;
myDataGridTableStyle.GridColumnStyles.Add(colA);
myDataGridTableStyle.GridColumnStyles.Add(colB);
myDataGridTableStyle.GridColumnStyles.Add(colC);
myBindingSource.DataSource = cand.ToBindingList();
myDataGridTableStyle.MappingName = myBindingSource.GetListName(null);
dataGrid1.TableStyles.Clear(); // Recommended on MSDN in the code examples.
dataGrid1.TableStyles.Add(myDataGridTableStyle);
dataGrid1.DataSource = myBindingSource;
Why don't you make the DCode property a slave to your Designation property so that:
Canidate c = new Candidate();
c.Designation = 501;
print(c.DCode);//outputs "SSE"
then you can bind to DCode when you just want the string interpretation of Designation.

XPages - unsorted Dojo Data Grid opens incorrect document

I'm using a Dojo Data grid together with a REST service to display view data. When I double click on a row, an XPage is opened. My problem is that, if one of the columns in the grid is not sorted, the wrong XPage is opened. What could be the problem here?
<xe:djxDataGrid id="P_Alle_DDG" store="restService2"
styleClass="DojoViewTable" title="Pendenzen - Alle" autoHeight="20"
rowsPerPage="25" selectable="true" selectionMode="multiple"
singleClickEdit="true" rowSelector="2" style="font-size:12pt"
escapeHTMLInData="true">
<xe:this.onRowDblClick><![CDATA[var idx = arguments[0].rowIndex;
var unid = restService2._items[idx].attributes["#unid"];
var url = 'Reparatur.xsp?documentId='+unid+'&action=openDocument';
window.document.location.href = url;]]></xe:this.onRowDblClick>
UPDATE: With the following JavaScript code the problem has been solved:
var grid = arguments[0].grid;
var index = arguments[0].rowIndex;
var item = grid.getItem(index);
var unid = item.attributes["#unid"];
var url = 'Reparatur.xsp?documentId='+unid+'&action=openDocument';
window.document.location.href = url;
Tony, try this method of opening the document. The code if very similar to yours, but the key difference is that I made a view column that contains the unid, I called it "docid". This works for me.
var grid = arguments[0].grid;
var index = arguments[0].rowIndex;
var item = grid.getItem(index);
var unid = item["docid"];
var url = "New_PO.xsp?doc=" + unid;
window.document.location.href = url;

Visualization SPmenuField in SPGridView

I have created SPGridView and added one SPMenuField as the first column and some BoundFields. Then I added MenuTemplate to the first column. But there are rectangles with white color border. I want to hide them. How can I do it ?
Here is the code I use:
SPMenuField colMenu = new SPMenuField();
colMenu.HeaderText = "Title";
colMenu.TextFields = "Title";
colMenu.MenuTemplateId = "TitleListMenu";
colMenu.NavigateUrlFields = "WebId, ListId, ID";
colMenu.NavigateUrlFormat = "default.aspx?WebID={0}&ListID={1}&ListItemID={2}";
colMenu.TokenNameAndValueFields = "Param1=ID";
colMenu.SortExpression = "Title";
MenuTemplate typeListMenu = new MenuTemplate();
typeListMenu.ID = "TitleListMenu";
// ... //
Controls.Add(typeListMenu);
customGridView.Columns.Add(colMenu);
Here is the answer on my question. It is nesseccery to narrow the .ms-menuimagecell css class.