OpenXml - How to remove lines between points in a scatterChart - excel

I have plotted a scatterChart in an Excel file using OpenXml. The points are joined by line. How can I remove the line? I tried doing this:
ScatterStyle scatterStyle = new ScatterStyle() { Val = ScatterStyleValues.Marker };
scatterchart.AppendChild<ScatterStyle>(scatterStyle);
But Excel repairs the file and changes the value back to ScatterStyleValues.LineMarker from ScatterStyleValues.Marker.
Please help me. Thankyou

It turns out that you have to add a shape property to your series, and add an outline where fill = nofill.
enter code here
//ChartShapeProperty of series
ChartShapeProperties SeriesShapeProperty = new DocumentFormat.OpenXml.Drawing.Charts.ChartShapeProperties();
DocumentFormat.OpenXml.Drawing.Outline outline = new DocumentFormat.OpenXml.Drawing.Outline(new DocumentFormat.OpenXml.Drawing.NoFill()) { Width = 28575 };
SeriesShapeProperty.Append(outline);
scatterChartSeries.Append(SeriesShapeProperty);

Related

Remove unwanted horizontel blue lines from excel generated using epplus which are not gridlines

I am working on generating excel using epplus in MVC5 which is almost completed but still i am getting a bug in creation of excel file. I am getting Horizontal blue lines in the generated excel.
I have tried making show grid lines to false but it is not helping. Also i have tried to make excel top or bottom border none of those particular rows in which the blue horizontal lines is showing
workSheet.Cells[7, 3, 7, 10000].Style.Border.Top.Style = ExcelBorderStyle.ThiworkSheet.Cells["A9:AMJ9"].Style.Border.Top.Style = ExcelBorderStyle.Thin; workSheet.Cells["A11:AMJ11"].Style.Border.Top.Style = ExcelBorderStyle.Thin;
workSheet.Cells["A3:AMJ3"].Style.Border.Top.Style = ExcelBorderStyle.Thin;
workSheet.Cells["A14:AMJ14"].Style.Border.Top.Style = ExcelBorderStyle.Thin;
workSheet.Cells["A49:AMJ49"].Style.Border.Top.Style = ExcelBorderStyle.None;
workSheet.View.ShowGridLines = false;
Question
How to remove these unnecessary horizontal blue lines?

How to flip axes and show it zoomed in for LineGraph MPAndroidchart

I'm not sure how to flip the axes of my chart. Below is the code I'm using.
Please see also the picture on how it looks right now. Instead of drawing the data vertically I'd like to show it horizontally. It suppose to look like a stock chart because that is what it actually is. I'm using YQL to get the historical data of the symbol as Json format.
I also see the data is scooped in the whole screen. I'd like to see the last month for example and just allow the user to swipe to the right for more or just to zoom out.
I'd appreciate some help.
float vals=0;
String[] resultStrs = new String[StockHistoryArray.length()];
for (int i = 0; i < StockHistoryArray.length(); i++) {
JSONObject chartDataObj = StockHistoryArray.getJSONObject(i);
yVals.add(new Entry(vals,(int) Float.parseFloat(chartDataObj.getString("Adj_Close")),i+1));
xVals.add(i, String.valueOf(vals));
vals++;
}
LineDataSet setting = new LineDataSet(yVals, "Stock Chart");
ArrayList<ILineDataSet> dataSets = new
ArrayList<ILineDataSet>();
dataSets.add(setting);
LineData data = new LineData(xVals, dataSets);
lineChart.setData(data);
Legend l = lineChart.getLegend();
l.setForm(Legend.LegendForm.LINE);
l.setTextColor(Color.WHITE);
XAxis x1 = lineChart.getXAxis();
x1.setTextColor(Color.WHITE);
x1.setDrawGridLines(false);
x1.setAvoidFirstLastClipping(true);
YAxis y1 = lineChart.getAxisLeft();
y1.setTextColor(Color.WHITE);
y1.setAxisMaxValue(120f);
y1.setDrawGridLines(true);
return null;
Here is the screen shot after I run this code. It is one year history.
screen capture
You are doing wrong in the following line.
yVals.add(new Entry(vals,(int) Float.parseFloat(chartDataObj.getString("Adj_Close")),i+1));
Use like this to draw the chart correctly
yVals.add(new Entry(entryVal,entryXIndex);
If your value in chartDataObj.getString("Adj_Close")
then you need to add like this
yVals.add(new Entry(Float.parseFloat(chartDataObj.getString("Adj_Close")), i);

libgdx table lays out components only in bottom right area

I'm using a Table to add some Labels to a stage. For some reason it adds it to the bottom right corner instead of the top left. Any ideas about how I can lay out the components correctly?
int dialogWidth = 450;
int dialogHeight = 650;
Label label1 = new Label("MUSIC:", skin);
Label label2 = new Label("SOUND EFFECTS:", skin);
Label label3 = new Label("JUMP SPEED:", skin);
TextButton btn1 = new TextButton("whatever", skin);
final Dialog dialog = new Dialog("Properties", skin);
dialog.setSize(dialogWidth, dialogHeight);
dialog.setX(Helper.RESOLUTION_X_CENTER-dialogWidth/2);
dialog.setY(Helper.RESOLUTION_Y_CENTER-dialogHeight/2);
Table t = new Table();
t.setBounds(0, 0, dialogWidth, dialogHeight);
t.add(label1);
t.row();
t.add(label2);
t.add(btn1);
t.row();
t.add(label3);
dialog.add(t);
stage.addActor(dialog);
Fix 1:
Solution: Remove the following line
t.setBounds(0, 0, dialogWidth, dialogHeight);
Reason: Don't use setBounds yourself. Let the layoutmanager handle it.
Fix 2:
Solution: Replace the following line
dialog.add(t);
with
dialog.getContentTable().add(t).expand().left().top();
Reason: Dialog is itself a Table which contains 3 components viz Title, ContentTable, ButtonTable.
Your code was adding the new Table in the row of ButtonTable (last row hence at bottom) after ButtonTable (hence right).
The updated code adds it to the Content Table where it is supposed to be.
Refer to https://github.com/EsotericSoftware/tablelayout to understand reason behind
expand().left().top();
Lastly, to debug any Table related issue, consider using debug lines (explained in the same link)
Hope this helps.

Office Open XML: Drawing Dashed Line in Chart

Using office open XML SDK I have drawn a scatter chart with smooth line but wondering how to change the line style for the series to show dashed line?
Finally I figured it out using OPenXML Productivity tool. You have to change the PresetDash property to System.Dash.
private void MakeSeriesDashedLine(ScatterChartSeries scs)
{
C.ChartShapeProperties chartShapeProperties1 = new C.ChartShapeProperties();
A.Outline outline1 = new A.Outline();
A.PresetDash presetDash1 = new A.PresetDash() { Val = A.PresetLineDashValues.SystemDash };
outline1.Append(presetDash1);
chartShapeProperties1.Append(outline1);
scs.Append(chartShapeProperties1);
}

Display custom tool tip in Jqplot Line chart?

For example I have plotted a line chart based on the date and number of students registered on a particular day on x and y axis respectively. When i mouse over to a particular point in the line chart i can view the tool tip displaying the x and y axis values. Instead I want to display the names of the students registered on that day when I mouse over to a particular point. Is there any solution for this problem? If there is no work around with Jqplot, please suggest me any other charts.. Please help me out. Thanks in advance.
Here's a little example I put together for you.
It uses the largely undocumented tooltipContentEditor property of the highlighter plugin:
highlighter: {
show: true,
sizeAdjust: 7.5,
tooltipContentEditor:tooltipContentEditor
}
Where your data is predefined like:
var students = [
['Bob','Mark','Dave'],
['Tim','Mike']
];
var data = [students[0].length,students[1].length];
function tooltipContentEditor(str, seriesIndex, pointIndex, plot) {
// display series_label, x-axis_tick, y-axis value
return students[pointIndex].join(", ");
}

Resources