Im having radchart showing the 2 bar series and 2 line series.Bar series is showing according to the left side y axis and line series is not binding according to the right side additional y axis.right axis which line series has to bind but only one of them is binding and other is not showing it binding to the left Y-axis.
Please can anybody provide me any solution is much a appreciated
Try this:
AxisY axisY = new AxisY();
axisY.AxisName = "AxisY1";
axisY.Title = "";
axisY.IsZeroBased = true;
axisY.DefaultLabelFormat = "#VAL{P0}";
SellInproductChart.DefaultView.ChartArea.AdditionalYAxes.Add(axisY);
AxisY axisY1 = new AxisY();
axisY1.AxisName = "AxisY2";
axisY1.Title = "";
axisY1.IsZeroBased = true;
axisY1.DefaultLabelFormat = "#VAL{P0}";
SellInproductChart.DefaultView.ChartArea.AdditionalYAxes.Add(axisY1);
objSeriesMapping1.SeriesDefinition.AxisName = "AxisY1";
objSeriesMapping2.SeriesDefinition.AxisName = "AxisY2";
Related
The contents to the text layer are added from csv import. Some are short length and some are long, contain 2 words and take up 2 lines in the layer. What I need is after the content is added, the layer should be horizontally and vertically aligned to another layer. I want to do this alignment using a script.
var doc = app.activeDocument;
var grps = doc.layerSets;
var pnamegrp = grps.getByName('Group 1');
var childlyr = pnamegrp.layers.getByName('child');
childlyr.textItem.contents = pname; //come from a csv file
var parentlyr= pnamegrp.layers.getByName('ReferenceRectangle');
Align_HorizCenter_VerticalCenter_withreference( childlyr , parent);
function Align_HorizCenter_VerticalCenter_withreference( child, parent){
//need help to write this
}
I am using Photoshop cc 2015 and JavaScript jsx file scripting.
Just incase somebody is looking for a solution. Translate is the method to move layer. The number of pixels to be moved can be determined by the difference in the width between the target and reference layer.
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.INCHES;
var doc = app.activeDocument;
var grps = doc.layerSets;
var pnamegrp = grps.getByName('Group 1');
var pnamelyr= pnamegrp.layers.getByName('pname'); //target
var pnameREF = pnamegrp.layers.getByName('Rectangle 1'); //reference var LB = pnameREF.bounds;
var RWidth = (LB[2].value) - (LB[0].value);
var RHeight = (LB[3].value) - (LB[1].value);
pnamelyr.textItem.contents = pnamearr[i];
LB = pnamelyr.bounds;
TWidth = (LB[2].value) - (LB[0].value);
THeight = (LB[3].value) - (LB[1].value);
var OffsetX = (RWidth - TWidth)/2;
var OffsetY = (RHeight - THeight)/2;
pnameTGT.translate(OffsetX,OffsetY); //move layer by offset pixels from the current position
I am trying to create an application which should consist of a line drawn when keyboard key is pressed. When the left arrow in the keyboard is pressed then the line should move in left direction. When right arrow in the keyboard is pressed then the respective line should move in right direction.
I think it is possible with Path class but I don't know how to implement. Even I don't know how to start the code. Can you please guide me how to draw the line in windows store apps.
private PathGeometry DrawGeometry()
{
bool largeArc = WedgeAngle > 180.0;
Size outerArcSize = new Size(Radius, Radius);
Size innerArcSize = new Size(InnerRadius, InnerRadius);
Point innerArcStartPoint = Utilities.ComputeCartesianCoordinate(RotationAngle, InnerRadius);
Point ButtomLineEndPoint = Utilities.ComputeCartesianCoordinate(RotationAngle, Radius);
Point OuterArcEndPoint = Utilities.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, Radius);
Point EndLineEndPoint = Utilities.ComputeCartesianCoordinate(RotationAngle + WedgeAngle, InnerRadius);
innerArcStartPoint.X += CentreX;
innerArcStartPoint.Y += CentreY;
ButtomLineEndPoint.X += CentreX;
ButtomLineEndPoint.Y += CentreY;
OuterArcEndPoint.X += CentreX;
OuterArcEndPoint.Y += CentreY;
EndLineEndPoint.X += CentreX;
EndLineEndPoint.Y += CentreY;
PathFigure path = new PathFigure();
path.StartPoint = innerArcStartPoint;
ArcSegment InnerArc = new ArcSegment();
InnerArc.Size = innerArcSize;
InnerArc.SweepDirection = SweepDirection.Counterclockwise;
InnerArc.Point = innerArcStartPoint;
InnerArc.IsLargeArc = largeArc;
LineSegment ButtomLine = new LineSegment();
ButtomLine.Point = ButtomLineEndPoint;
ArcSegment OuterArc = new ArcSegment();
OuterArc.SweepDirection = SweepDirection.Clockwise;
OuterArc.Point = OuterArcEndPoint;
OuterArc.Size = outerArcSize;
OuterArc.IsLargeArc = largeArc;
LineSegment EndLine = new LineSegment();
EndLine.Point = EndLineEndPoint;
path.Segments.Add(ButtomLine);
path.Segments.Add(OuterArc);
path.Segments.Add(EndLine);
path.Segments.Add(InnerArc);
PathGeometry myPath = new PathGeometry();
myPath.Figures.Add(path);
return myPath;
}
This code will Draw a Pie slice for you as I was building a PieChart it Containsn Lines Curves etc. It will save lots of your time
I want to float an image on the right of some text in a table cell.
cell.AddParagraph("some text");
cell.AddParagraph("next line other text");
Paragraph p = cell.AddParagraph();
p.Format.Alignment = ParagraphAlignment.Right;
p.Format.RightIndent = 12;
Image image = p.AddImage("image.png");
image.ScaleWidth = 0.07;
This code puts the image to the right, but I can't move it up.
p.Format.Linespacing = -10;
image.WrapFormat.DistanceTop = -10;
These settings did not work.
For moving elements up or down SpaceBefore and SpaceAfter can be used.
In this case:
p.Format.SpaceBefore = - 20;
A chart on a form I created has two overlapping areas. The overlapping part works just fine. The problem is that visible graph only takes up half the height of the chart control:
The bottom half of the control is left empty (presumably because that's where the second area would have gone were the two areas not aligned?). I can't figure out how to get the chart to use the entire control. The code is below:
chart1.Dock = DockStyle.Fill;
chart1.Legends.Add(new Legend { Name = "Legend1" });
chart1.Location = new Point(435, 3);
chart1.Name = "chart1";
chart1.Size = new Size(426, 287);
chart1.TabIndex = 2;
chart1.Text = "chart1";
var firstArea = chart1.ChartAreas.Add("First Area");
var seriesFirst = chart1.Series.Add("First Series");
seriesFirst.ChartType = SeriesChartType.Line;
seriesFirst.Points.Add(new DataPoint(10, 55));
seriesFirst.Points.Add(new DataPoint(11, 56));
seriesFirst.Points.Add(new DataPoint(12, 59));
var secondArea = chart1.ChartAreas.Add("Second Area");
secondArea.BackColor = Color.Transparent;
secondArea.AlignmentOrientation = AreaAlignmentOrientations.All;
secondArea.AlignmentStyle = AreaAlignmentStyles.All;
secondArea.AlignWithChartArea = firstArea.Name;
secondArea.AxisY.LabelStyle.Enabled = false;
secondArea.AxisX.LabelStyle.Enabled = false;
var seriesSecond = chart1.Series.Add("Second Series");
seriesSecond.ChartType = SeriesChartType.Line;
seriesSecond.ChartArea = secondArea.Name;
seriesSecond.Points.Add(new DataPoint(10, 1001));
seriesSecond.Points.Add(new DataPoint(11, 1015));
seriesSecond.Points.Add(new DataPoint(12, 1016));
This is some old code I've dug out and modified to suit your example. The problem is the InnerPlotPosition.Auto and Position.Auto status of the ChartAreas, thats why after you add the second chart the first charts auto position jumps up and then the second chart aligns with the new InnerPlotPosition.Auto values.
You can try turning this off but I think its easier to just position the first chart manually and then allow the second to align with the new manual position. It produces the below image (minus your legend you can work the values needed yourself)
Bit of pain in the ass solution but hopefully it helps
Dim chart1 As New Chart
Me.Controls.Add(chart1)
chart1.Location = New Point(435, 3)
chart1.Name = "chart1"
chart1.Size = New Size(426, 287)
chart1.TabIndex = 2
chart1.Text = "chart1"
Dim firstArea As ChartArea = chart1.ChartAreas.Add("First Area")
Dim seriesFirst = chart1.Series.Add("First Series")
seriesFirst.ChartType = SeriesChartType.Line
seriesFirst.Points.Add(New DataPoint(10, 55))
seriesFirst.Points.Add(New DataPoint(11, 56))
seriesFirst.Points.Add(New DataPoint(12, 59))
Dim secondArea As ChartArea = chart1.ChartAreas.Add("Second Area")
secondArea.BackColor = Color.Transparent
secondArea.AlignmentOrientation = AreaAlignmentOrientations.All
secondArea.AlignmentStyle = AreaAlignmentStyles.All
secondArea.AlignWithChartArea = firstArea.Name
secondArea.AxisY.LabelStyle.Enabled = False
secondArea.AxisX.LabelStyle.Enabled = False
Dim seriesSecond = chart1.Series.Add("Second Series")
seriesSecond.ChartType = SeriesChartType.Line
seriesSecond.ChartArea = secondArea.Name
seriesSecond.Points.Add(New DataPoint(10, 1001))
seriesSecond.Points.Add(New DataPoint(11, 1015))
seriesSecond.Points.Add(New DataPoint(12, 1016))
' *** Set locational values here for your first chart***
Dim heightAboveChartArea As Integer = 20
Dim heightBelowChartArea As Integer = 20
Dim axisLabelHeight As Integer = 40
Dim widthLeftOfChartArea As Integer = 20
Dim widthRightOfChartArea As Integer = 20
Dim heightPerBar As Integer = 20
Dim numberOfPoints As Integer = chart1.Series(0).Points.Count
' *** The following code should not normally be modified ***
chart1.Height = heightAboveChartArea + heightBelowChartArea + axisLabelHeight + (numberOfPoints * heightPerBar)
chart1.ChartAreas(0).Position.X = widthLeftOfChartArea / chart1.Width * 100
chart1.ChartAreas(0).Position.Width = 100 - (widthRightOfChartArea / chart1.Width * 100) - chart1.ChartAreas(0).Position.X
chart1.ChartAreas(0).Position.Y = (heightAboveChartArea / chart1.Height * 100)
chart1.ChartAreas(0).Position.Height = 100 - (heightBelowChartArea / chart1.Height * 100) - chart1.ChartAreas(0).Position.Y
I thought about monkeying with the position, but I'd have to take into account borders and the legend and other chart components and assumed I'd never get it as good as the auto-positioning provided by the chart - and it would drive me nuts. However, the suggestion by TylerDurden led me to the idea of simply delaying the addition of the second series/area until after the chart had rendered at least once and had calculated the position. This turned out to be non-trivial, since for most of the chart's initialization the X, Y, Height and Width are still zero. The best way I found was to add the second series in the Form's Shown event:
private void OnShown(object sender, EventArgs eventArgs)
{
Application.DoEvents();
var f = chart1.ChartAreas[0].Position.ToRectangleF();
chart1.ChartAreas[0].Position.Auto = false;
chart1.ChartAreas[0].Position.X = f.X;
chart1.ChartAreas[0].Position.Y = f.Y;
chart1.ChartAreas[0].Position.Height = f.Height;
chart1.ChartAreas[0].Position.Width = f.Width;
// add second area/series here
The call to Application.DoEvents() is required to force the chart to render and calculate the Position. Since Position is a percentage, both chart areas will always occupy the full height and width of the parent Chart.
I made a graph using MSChart and I was able to implement the zooming ability.
The graph can zoom but the problem arises when I want to move around after I zoom. When I click up and down on the y axis scrollbar, the scrolling increment is fine. However, for the x axis scrollbar, the scrolling increment is horrible. It will always go the very end even though there is data in the middle.
I tried looking online for the solution but was out of luck
here is my code:
// Chart area (where the axes and series are plotted)
ChartArea chartArea = new ChartArea();
chartArea.AxisX.Minimum = DateTime.MinValue.ToOADate();
chartArea.AxisY.Minimum = 0;
chartArea.AxisY.Maximum = 100;
//chartArea.AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;
chartArea.AxisX.Title = "Time";
chartArea.AxisX.LabelStyle.Format = DEFAULT_TIME_FORMAT_STRING;
chartArea.AxisY.LabelStyle.Format = "#########################";
chartArea.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.NotSet;
chartArea.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.NotSet;
chartArea.BackColor = Color.Transparent;
m_chart.ChartAreas.Add(chartArea);
//add zoom-in features for x and y axis
m_chart.ChartAreas[0].CursorY.Interval = 0;
m_chart.ChartAreas[0].CursorY.IsUserEnabled = true;
m_chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
m_chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
m_chart.ChartAreas[0].AxisY.ScrollBar.IsPositionedInside = true;
m_chart.ChartAreas[0].CursorX.Interval = 0;
//m_chart.ChartAreas[0].CursorX.AutoScroll = true;
//m_chart.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
m_chart.ChartAreas[0].CursorX.IsUserEnabled = true;
m_chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
m_chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
m_chart.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;
I dont see what I am doing wrong
Set the scaleview type to the appropriate time selection.
m_chart.ChartAreas[0].AxisX.ScaleView.SizeType = "Seconds";
m_chart.ChartAreas[0].AxisX.ScaleView.MinSizeType= "Seconds";
m_chart.ChartAreas[0].AxisX.ScaleView.SmallScrollMinSizeType= "Seconds";
m_chart.ChartAreas[0].AxisX.ScaleView.SmallScrollSizeType= "Seconds";
Just change
m_chart.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = false;
then the scroll bar will comes outside the chartarea and you will not face that problem.