How TChart point series bottom text hide? - visual-studio-2005

I'm use TChart version .Net & VS2005.
The problem of adding a point series.
How TChart point series bottom text hide?
Help me please. Thank you. =)
My Code :
private void GridNotch()
{
Steema.TeeChart.Styles.Points NotchPoint = new Steema.TeeChart.Styles.Points();
TChart1.Series.Add(NotchPoint);
Steema.TeeChart.Axis axis = new Steema.TeeChart.Axis();
TChart1.Axes.Custom.Add(axis);
axis.StartPosition = 5;
axis.EndPosition = 5;
axis.Labels.Items.Add(0, " ");
axis.Labels.Items.Add(5000, " ");
axis.Labels.Items[0].Visible = false;
axis.Labels.Items[1].Visible = false;
axis.Title.Caption = "";
axis.Title.Font.Color = Color.Black;
TChart1.Series[TChart1.Series.Count - 1].CustomVertAxis = axis;
if (dt_Notch.Columns.Count == 0)
{
dt_Notch.Columns.Add("Value", typeof(int));
dt_Notch.Columns.Add("Label", typeof(string));
DataRow row;
row = dt_Notch.NewRow();
row["Value"] = "100";
row["Label"] = "B5";
dt_Notch.Rows.Add(row);
}
TChart1.Series[TChart1.Series.Count - 1].XValues.DataMember = "Value";
TChart1.Series[TChart1.Series.Count - 1].YValues.DataMember = "Value";
TChart1.Series[TChart1.Series.Count - 1].LabelMember = "Label";
TChart1.Series[TChart1.Series.Count - 1].DataSource = dt_Notch;
}
My Graph :
Want Graph :

I see you are assigning the "B5" in your code:
row["Label"] = "B5";
You can either remove that label or force your bottom axis to show values and not labels:
TChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Value;

Related

Is it possible to Insert an anchored text frame above a text/word?

I want to mark each CharacterStyle in the document by placing an achored text frame above each text/word. I am quite new to scripting in indesign, so any help is much appreciated.
Here is the expected output:
I found a solution to this, and for those who might encounter the same problem as me here is my code :
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
app.findGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedCharacterStyle = style;
app.findGrepPreferences.findWhat = ".+";
var found_item = doc.findGrep();
var res_count = found_item.length;
if(res_count > 0){
var found_text = found_item[0].paragraphs.firstItem();
var insertion_character = (found_text.characters.lastItem().index);
var check_insertion_character = insertion_character + 1;
var alt_insertion_character = (found_text.characters.firstItem().index);
var the_story = found_text.parentStory;
try{
app.selection = the_story.insertionPoints[check_insertion_character];
app.selection = the_story.insertionPoints[alt_insertion_character];
}catch(err){
alert(err);
}
var the_anchored_frame = app.selection[0].textFrames.add({geometricBounds:["0","0",1,10],anchoredObjectSettings:{anchoredPosition: AnchorPosition.ABOVE_LINE, horizontalReferencePoint: AnchoredRelativeTo.ANCHOR_LOCATION, verticalReferencePoint: VerticallyRelativeTo.TOP_OF_LEADING}});
the_anchored_frame.contents = style;
// the_anchored_frame.appliedObjectStyle = real_anchor_style;
}
Cheers

How to show polynomial tread line in Am-Line chart

How can i show a polynomial tread line in Am-line chart. I'm getting a straight trend line here, i need a polynomial trend line. My javascript code is shown below. Please someone help me to solve this issue.
function GenChartData() {
var data1 = [0.234761158, 0.23816127, 0.263960124, 0.282558558, 0.300607979, 0.318197719, 0.316059534, 0.319133276, 0.322505238, 0.323926338, 0.323720379, 0.3203703, 0.318837626, 0.318380371, 0.321465339, 0.316398839, 0.310238176, 0.301206892, 0.278454166, 0.268778255, 0.250299958, 0.23754735, 0.216277621, 0.182483871, 0.152057602, 0.129372542, 0.079524595, 0.044074801, 0.007279248, -0.021369877, -0.022801251, -0.043247196, -0.060677351, -0.055932729, -0.055847788, -0.032625365, -0.027289726, -0.022615401, -0.010850169, 0.015833104, 0.043923065, 0.055500831, 0.048043121, 0.054154849, 0.064038257, 0.049914887, 0.046542406, 0.03154397, 0.033614909, 0.030570225, 0.035606699, 0.001179461, -0.028934007, -0.019034206, 2.30344E-05];
var dates = ["12/31/2001", "1/31/2002", "2/28/2002", "3/31/2002", "4/30/2002", "5/31/2002", "6/30/2002", "7/31/2002", "8/31/2002", "9/30/2002", "10/31/2002", "11/30/2002", "12/31/2002", "1/31/2003", "2/28/2003", "3/31/2003", "4/30/2003", "5/31/2003", "6/30/2003", "7/31/2003", "8/31/2003", "9/30/2003", "10/31/2003", "11/30/2003", "12/31/2003", "1/31/2004", "2/29/2004", "3/31/2004", "4/30/2004", "5/31/2004", "6/30/2004", "7/31/2004", "8/31/2004", "9/30/2004", "10/31/2004", "11/30/2004", "12/31/2004", "1/31/2005", "2/28/2005", "3/31/2005", "4/30/2005", "5/31/2005", "6/30/2005", "7/31/2005", "8/31/2005", "9/30/2005", "10/31/2005", "11/30/2005", "12/31/2005", "1/31/2006", "2/28/2006", "3/31/2006", "4/30/2006", "5/31/2006", "6/30/2006"];
for (var i = 0; i < dates.length; i++) {
chartData.push({
date: new Date(dates[i]),
data1: data1[i]});
}
}
AmCharts.ready(function () {
// SERIAL CHART
GenChartData();
chart = new AmCharts.AmSerialChart();
chart.pathToImages = "JS/AmFiles/amcharts/images/";
chart.marginTop = 0;
chart.marginRight = 10;
chart.autoMarginOffset = 5;
//chart.backgroundColor = "#CCCCC";
chart.zoomOutButton = {
backgroundColor: '#000000',
backgroundAlpha: 0.15
};
chart.dataProvider = chartData;
chart.categoryField = "date";
// listen for "dataUpdated" event (fired when chart is rendered) and call zoomChart method when it happens
chart.addListener("dataUpdated", zoomChart);
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.parseDates = true; // as our data is date-based, we set parseDates to true
categoryAxis.minPeriod = "MM"; // our data is daily, so we set minPeriod to DD
categoryAxis.dashLength = 1;
categoryAxis.gridAlpha = 0.15;
categoryAxis.axisColor = "#DADADA";
categoryAxis.labelFrequency = 1;
categoryAxis.equalSpacing = true;
// value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.axisAlpha = 0.2;
valueAxis.dashLength = 1;
chart.addValueAxis(valueAxis);
graph = new AmCharts.AmGraph();
graph.type = "smoothedLine";
graph.lineColor = "#180ad1";
graph.negativeLineColor = "#180ad1";
graph.bullet = "round";
graph.bulletSize = 5;
graph.lineThickness = 2;
graph.valueField = "data1";
chart.addGraph(graph);
// CURSOR
chartCursor = new AmCharts.ChartCursor();
chartCursor.cursorPosition = "mouse";
chart.addChartCursor(chartCursor);
// TREND LINES
// first trend line
var trendLine = new AmCharts.TrendLine();
trendLine.initialDate = new Date(chartData[0].date); // 12 is hour - to start trend line in the middle of the day
trendLine.finalDate = new Date(chartData[chartData.length-1].date);
trendLine.initialValue = 0.234761158;
trendLine.finalValue = 2.30344E-05;
trendLine.lineColor = "#CC0000";
chart.addTrendLine(trendLine);
// WRITE
chart.write("chartdiv");
});
Thanks for your help
You would need to basically have another graphline on there rather than a trendline.
You can look at this example - http://www.amcharts.com/javascript-charts/line-with-different-bullet-sizes/
to see how to equip multiple data graphs.

Visifire.Charts How to disable vertical lines. WP

Chart is created by code. But I can't disable vertical lines in chart.
It is a code of creating chart:
public void CreateChart() {
CleanChart();
visiChart = new Chart()
{
ToolTipEnabled = true,
Width = 400,
Height = 200,
Padding = new Thickness(0),
Margin = new Thickness(0, 6, 0, -12),
Background = new SolidColorBrush(Colors.White),
};
ChartGrid grid = new ChartGrid()
{
Enabled = false
};
DataSeries dataSeries = new DataSeries();
DataPoint dataPoint;
Axis yAx = new Axis()
{
AxisLabels = new AxisLabels() { Enabled = false },
Grids = new ChartGridCollection() {grid}
};
int i = 0;
var deps = App.CurrentAgreement.Deposits.Deposit.Where(x => x.DepositIliv + x.DepositLink > 0).ToList();
foreach (var dep in deps) {
dataPoint = new DataPoint();
dataPoint.YValue = dep.DepositIliv + dep.DepositLink + dep.UValue + dep.WarrantyValue;
dataPoint.XValue = i;
i++;
dataPoint.LabelText = dataPoint.YValue.Out();
dataPoint.AxisXLabel = DateTime.Parse(dep.DepositDate).ToString("MMM yyyy");
dataPoint.MouseLeftButtonUp += dataPoint_MouseLeftButtonUp;
dataSeries.DataPoints.Add(dataPoint);
}
dataSeries.LabelEnabled = true;
dataSeries.RenderAs = RenderAs.Column;
dataSeries.Color = new SolidColorBrush(Colors.Green);
visiChart.Series.Add(dataSeries);
visiChart.AxesY.Add(yAx);
ChartPlaceHolder.Children.Add(visiChart);
}
But i dont need vertical lines visible. It is a screen of chart.
How i can disable lines??
Help me, please.
You have to disable the Grid lines from AxisX also.
Example:
ChartGrid grid = new ChartGrid()
{
Enabled = false
};
Axis xAx = new Axis();
xAx.Grids.Add(grid);
visiChart.AxesX.Add(xAx);

Border for created cell with npoi

I have an Excel File which serves as a template for my Excel work and I want to programatically fill this template with data.
When I create a row and an accompanying cell and set a border for the newly created cell, the whole sheet is assigned this border. Naturally, I only want the single cell to have that border. Here is the code:
string path = Application.StartupPath + "\\" + "Excels\\myTemplate.xls";
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
HSSFSheet sheet = templateWorkbook.GetSheet("sheet2");
int rowIndex = 3;
var row = sheet.CreateRow(rowIndex);
int i = 0;
string zoneNo;
string SubsidiaryCode = string.Empty;
foreach (DataRow r in dtBill.Rows)
{
SubsidiaryCode = (r["SubsidiaryCode"].ToString().Trim());
zoneNo = (r["ZoneNO"].ToString().Trim());
HSSFCell cell = (HSSFCell)row.CreateCell(i);
cell.SetCellValue("Zone " + zoneNo + "-code :" + SubsidiaryCode);
cell.CellStyle.BorderBottom = HSSFCellStyle.BORDER_MEDIUM;
i++;
row.CreateCell(i).SetCellValue(r["Date"].ToString().Trim());
row.CreateCell(i).CellStyle.BorderBottom = HSSFCellStyle.BORDER_MEDIUM;
i++;
rowIndex++;
row = sheet.CreateRow(rowIndex);
i = 0;
}
sheet.ForceFormulaRecalculation = true;
I found the answer
var row = sheet.CreateRow(rowGlobal);
HSSFCellStyle style1 = templateWorkbook.CreateCellStyle();
style1.BorderRight = HSSFCellStyle.BORDER_MEDIUM;
style1.BorderBottom = HSSFCellStyle.BORDER_MEDIUM;
style1.Alignment = HSSFCellStyle.ALIGN_CENTER;
//style1.FillPattern = HSSFCellStyle.SOLID_FOREGROUND;
//style1.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.GREEN.index;
HSSFFont font1 = templateWorkbook.CreateFont();
//font1.Color = NPOI.HSSF.Util.HSSFColor.BROWN.index;
font1.FontName = "B Nazanin";
style1.SetFont(font1);
cell = row.CreateCell(2);
cell.SetCellValue(0);
cell.CellStyle = style1;

After casting PushPin , get this Possible unitended reference comparison underline message

I Have this error message :
Possible unitended reference comparison; to get a value coparison, cast the left hand side to type string
problem :
((Pushpin)p).Tag == "locationPushpin"));
============================
double Dlat = Convert.ToDouble(g_strLat);
double Dlon = Convert.ToDouble(g_strLon);
this.map1.Center = new GeoCoordinate(Dlat, Dlon);
if (this.map1.Children.Count != 0)
{
var pushpin = map1.Children.FirstOrDefault(p => (p.GetType() == typeof(Pushpin) && ((Pushpin)p).Tag == "locationPushpin"));
if (pushpin != null)
{
this.map1.Children.Remove(pushpin);
}
}
Pushpin locationPushpin = new Pushpin();
//---set the location for the pushpin---
locationPushpin.Tag = "locationPushpin";
locationPushpin.Location = new GeoCoordinate(Dlat, Dlon);
locationPushpin.Content = new Ellipse()
{
Fill = new SolidColorBrush(Colors.Orange),
//Opacity = .8,
Height = 40,
Width = 30
};
locationPushpin.Width = 60;
locationPushpin.Height = 100;
this.map1.Center = new GeoCoordinate(Dlat, Dlon);
this.map1.Children.Add(locationPushpin);
this.map1.ZoomLevel = 13;
Would appreciate your help. Thanks
Firstly, your query would only find exact objects of type Pushpin. This is cleaner:
var pushpin = map1.Children.OfType<Pushpin>()
.FirstOrDefault(p => p.Tag == "locationPushpin");
The next problem is that Tag is of type object. So you really want:
var pushpin = map1.Children.OfType<Pushpin>()
.FirstOrDefault(p => "locationPushpin".Equals(p.Tag));
Otherwise you'll be doing a reference comparison between the Tag value and the string. So you could have equal but distinct strings, and the pushpin wouldn't be found.

Resources