Extjs Charting Series with dashed line - extjs

I am using Extjs 4 to create a line chart. Now I want to create a chart series with a dashed line. Currently my code looks the following way:
series: [{
type: 'line',
axis: 'left',
xField: 'name',
yField: 'data1',
style: {
fill: '#18428E',
stroke: '#18428E',
'stroke-width': 3
},
markerConfig: {
type: 'circle',
size: 4,
radius: 4,
'stroke-width': 0,
fill: '#18428E',
stroke: '#18428E'
}
}, ...
I tried setting the 'border-style' to 'dashed' but this neither works.
Is this possible in ExtJs Charting?

You just missed one property to get the dashed lines working. You need to add stroke-dasharray property as well. Here is the updated code:
style: {
fill: '#18428E',
stroke: '#18428E',
'stroke-width': 3,
'stroke-dasharray': 10 // You need to add this!
},
markerConfig: {
type: 'circle',
size: 4,
radius: 4,
'stroke-width': 0,
fill: '#18428E',
stroke: '#18428E'
},
You will have to play with the value (10 in my case) to get your desired dash length. Note that this will not work with IE (since its using VML to render the graph). Other browsers should render it properly.

In ExtJS 5.x or 6.x when using sencha-charts (not ext-charts package), stroke-dasharray won't work. After lot of effort, discovered the lineDashed property of Ext.draw.sprite.Sprite works like a charm. So, if you are using sencha-chart package the style config should look like :
style: {
fill: '#18428E',
stroke: '#18428E',
'stroke-width': 3,
lineDash: [10,10] // Draws dashed lines
}
Hope this will be useful for anyone having problem with sencha-charts.

Related

Can not have more then 7 numbers in Pie Chart from Apex Charts

I have come across this strange problem and would like to know if there is a solution to it. I am using ApexChart Pie Chart to show a breakdown but whenever I go above the 7 number it gives this error. The error does not appear if the series array (see code below) is 7 or less.
Uncaught (in promise) TypeError: t.push is not a function
Here is my code
const [series, setSeries] = useState([8, 17, 3, 3, 3, 3, 10, 34])
const options = {
chart: {
width: 500,
type: 'pie',
foreColor: '#373d3f'
},
labels: ['Alpha', 'Charlie', 'Delta', 'Mike', 'NS', 'Deltaa', 'Mikee', 'er'],
stroke: {
show: true,
curve: 'smooth',
lineCap: 'butt',
colors: "#03111E",
width: 2,
dashArray: 0,
},
responsive: [{
breakpoint: 540,
options: {
chart: {
width: 350
},
legend: {
position: 'bottom'
}
}
}]
}
<Chart options={options} series={series} type="pie" height={360 + Math.random() * 10}
width={550}
style={{margin: "auto"}}/>
Versions
"apexcharts": "^3.35.3",
"react-apexcharts": "^1.4.0",
I have seen some other question related to this but sadly they do not answer the question. I would like to know if there is a solution to this or is this just a limitation of ApexChart. Thank you.
Work fine when you pass stroke colors as array, not string
stroke: {
...
colors: ["#03111E"],
...
}
https://apexcharts.com/docs/options/stroke/#colors

ExtJS 7.2 chart missing markers

For whatever reason, my line series is not generating markers in ExtJS 7.2.
Following is my code, and image of current output is attached.
new Ext.chart.series.Line({
axis: 'left',
//smooth: true,
fill:false,
xField: 'name',
yField: 'aggregate',
style: {
lineWidth: 2,
stroke: '#30BDA7',
fillOpacity: 0.5
},
title: 'Aggregate Count',
tooltip:{
trackMouse:true,
titleAlign:'center',
renderer: function(toolTip, record, ctx) {
toolTip.setHtml(record.get(ctx.field));
}
},
marker: {
type: 'path',
path: ['M', - 4, 0, 0, 4, 4, 0, 0, - 4, 'Z'],
stroke: '#30BDA7',
//'stroke-width':5,
lineWidth: 2,
fill: 'black'
},
showMarkers:true,
selectionTolerance:20
})
After many hours of searching I discovered that I had to addd a series to the chart using lazy rendering. To fix the code I simply removed the explicit declaration "new Ext.chart.series.Line" and converted it to "type:'line'". Everything magically worked after that. The reason for this is that the series will not generate an overlay surface when explicitly defined.
{
type:'line'
axis: 'left',
//smooth: true,
fill:false,
xField: 'name',
yField: 'aggregate',
style: {
lineWidth: 2,
stroke: '#30BDA7',
fillOpacity: 0.5
},
title: 'Aggregate Count',
tooltip:{
trackMouse:true,
titleAlign:'center',
renderer: function(toolTip, record, ctx) {
toolTip.setHtml(record.get(ctx.field));
}
},
marker: {
type: 'path',
path: ['M', - 4, 0, 0, 4, 4, 0, 0, - 4, 'Z'],
stroke: '#30BDA7',
//'stroke-width':5,
lineWidth: 2,
fill: 'black'
},
showMarkers:true,
selectionTolerance:20
}

Add a simple target line parallel to x-axis, in Nivo #nivo/ResponsiveLine

Trying to get this grey line parallel to x-axis as a marker of target (at of y-axis 67%).
you may put a markers props like:
markers={[
{
axis: 'y',
value: 520,
legend: 'TEST',
lineStyle: {
stroke: 'red',
},
textStyle: {
fill: 'red',
},
},
]}
the value determine the marker location, you can calculate based on data you passed.

How to decorate Google Line Chart using react-google-charts plugin

I am using react-google-charts in my reactjs application to create google line chart. I don't find any detailed document for this plugin.
I have few questions:
a) How to specify scaleStepWidth?
b) How to create pointDot in Line Chart?
To enable pointDot in line chart you have to just set "true" the points property option in configuration i-e
"pointsVisible: true"
Moreover you can find an example of line chart here
https://github.com/RakanNimer/react-google-charts/blob/HEAD/sandboxes/linechart/index.js
Other customization options if required then you can provide it in option property. for example just like below:
var options = {
//title: 'Graph',
//isStacked: true,
//legend: { position: 'top', maxLines: 3 },
width: chartwidth1 / 2 * 2,
height:450,
vAxis: {
gridlines: { count: 15 },
viewWindow: { min: -100000, max: 2000000},
},
//series: series,
chartArea: {
top: '10%', // set this to adjust the legend width
left: '8%', // set this eventually, to adjust the left margin
height: "80%",
width: "93%",
//width: "60%"
},
legend: { position: 'top', alignment: 'start' },
pointsVisible: true
}

How to change ExtJS line chart series order

I have a line chart with multiple series in 4.02. At different points the series lines cross, I need a specific line to remain as the top line i.e. biggest z-index (so that this line highlights and displays its tips when hovered over as opposed to the other ones).
I do not want to just reorder the sequence that the series are written in the javascript because I need the legend sequence to remain the same (they are all titled as dates and I want to keep them in date order).
I looked for some kind of Ext.chart.series.Line config option to set the z-index but was not successful.
I've already extended the base theme to define custom stroke-widths for the different lines, so I started to look for some kind of theme option to set a series z-index but have not been successful on that either.
Any ideas?
EDIT:
I've added the zindex config to my extended chart theme, this produces no errors but doesn't change anything in the chart at all (the first series listed with z-index 4 is on bottom, z-index 5 is second from bottom, z-index 3 is 3rd from bottom, etc.), seems it's over-ruled somewhere:
// CUSTOM CHART THEME
Ext.chart.theme.Events = Ext.extend(Ext.chart.theme.Base, {
constructor: function(config) {
Ext.chart.theme.Base.prototype.constructor.call(this, Ext.apply({
colors: ['rgb(0, 0, 0)',
'rgb(0,0,255)',
'rgb(255,0,0)',
'rgb(0,128,0)',
'rgb(128,0,128)'
],
seriesThemes: [{
'stroke-width': 3,
zindex: 4
}, {
'stroke-width': 1,
smooth: false,
zindex: 5
}, {
'stroke-width': 1,
smooth: false,
zindex: 3
}, {
'stroke-width': 1,
smooth: false,
zindex: 2
}, {
'stroke-width': 1,
smooth: false,
zindex: 1
}]
}, config));
}
});
Ok, I sorted it out, zIndex not zindex in the custom theme:
// CUSTOM CHART THEME
Ext.chart.theme.Events = Ext.extend(Ext.chart.theme.Base, {
constructor: function(config) {
Ext.chart.theme.Base.prototype.constructor.call(this, Ext.apply({
colors: ['rgb(0, 0, 0)',
'rgb(0,0,255)',
'rgb(255,0,0)',
'rgb(0,128,0)',
'rgb(128,0,128)'
],
seriesThemes: [{
'stroke-width': 3,
zIndex: 4
}, {
'stroke-width': 1,
smooth: false,
zIndex: 5
}, {
'stroke-width': 1,
smooth: false,
zIndex: 3
}, {
'stroke-width': 1,
smooth: false,
zIndex: 2
}, {
'stroke-width': 1,
smooth: false,
zIndex: 1
}]
}, config));
}
});

Resources